Copy link to clipboard
Copied
Hello , everyone.
I want to change the color of the text to CMYK with convert swatch color, but it fails.
when I manually convert it and GLOBAL option is checked, that's successful.
but below script did not make GLOBAL option checked.
Is it possible?
var newColor = new CMYKColor();
newColor.black = 100;
newColor.cyan = 0;
newColor.magenta = 0;
newColor.yellow = 0;
var ignoreColors = ['[None]', '[Registration]'];
var doc = activeDocument;
var swatches = doc.swatches;
for (var i = 0; i < swatches.length; i++) {
var shouldIgnore = false;
for (var j = 0; j < ignoreColors.length; j++) {
if (swatches[i].name === ignoreColors[j]) {
shouldIgnore = true;
break;
}
}
if (!shouldIgnore) {
alert(swatches[i].name);
swatches[i].color = newColor;
}
}
@Charu Rajput , Thanks for sharing how to change fill and stroke color by directly replacing the color, solved my problem.
Copy link to clipboard
Copied
@Charu Rajput , Thanks for sharing how to change fill and stroke color by directly replacing the color, solved my problem.