Add black color to the color list - only if it does not exist in the color list
Hello I am looking for a script that will add black color to the color list
) black = 100)
Only if it does not exist in the color list. not spot color!
Hello I am looking for a script that will add black color to the color list
) black = 100)
Only if it does not exist in the color list. not spot color!
var _doc = app.documents[0];
var _isBlackExists = false;
var _swatches = _doc.swatches;
for (var i = 0; i < _swatches.length; i++) {
var _swatch = _swatches[i];
if (_swatch.color.cyan == 0 && _swatch.color.yellow == 0 && _swatch.color.magenta == 0 && _swatch.color.black == 100) {
_isBlackExists = false;
break;
} else if (_swatch.name.toLowerCase() == 'black') {
_isBlackExists = false;
break;
}
}
if (!_isBlackExists) {
var _blackSwatch = _doc.swatches.add();
var _color = new CMYKColor();
_color.cyan = 0;
_color.yellow = 0;
_color.magenta = 0;
_color.black = 100;
_blackSwatch.color = _color;
_blackSwatch.name = 'Black';
}
If you set this to false, then Balck color will always be created even if it exists
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.