Copy link to clipboard
Copied
Hi Everyone,
I need to get all unnamed colours in indesign. But this colours are not shown in Swatches panel.
I tried the below code not retrieving the unnamed colours we used in document.
var allSwatches = app.documents[0].swatches;
Can anyone advise me to get the CMYK vlaues of all unnamed colours?
Thanks.
Hi @AD4003,
I have not tested it extensively but iterating the colors collection and picking colors that have a blank name should be the unnamed color list. So something like the following should work. The cymk value(if its a CMYK color) can be obtained from the colorValue property of the color
var unusedColor = []
for(var i = 0; i < app.documents[0].colors.length; i++)
{
if(app.documents[0].colors[i].name == "")
unusedColor.push(app.documents[0].colors[i])
}
-Manan
Copy link to clipboard
Copied
Hi @AD4003,
I have not tested it extensively but iterating the colors collection and picking colors that have a blank name should be the unnamed color list. So something like the following should work. The cymk value(if its a CMYK color) can be obtained from the colorValue property of the color
var unusedColor = []
for(var i = 0; i < app.documents[0].colors.length; i++)
{
if(app.documents[0].colors[i].name == "")
unusedColor.push(app.documents[0].colors[i])
}
-Manan
Copy link to clipboard
Copied
Thank you so much Manan.