Select a global color swatch and change its CMYK color code
Hi guys,
I am new to Illustrator development, but I need to find a solution for a problem, that an illustrator developer I hired couldn't solve.
That's the issue:
I have an illustrator file, where you can find different global colors (swatches).
Let's say we have 3 of them. Their names are:
- global color 1
- global color 2
- global color 3
I want to build a script that allows me to select one of those colors by the name of the global color and change its CMYK color code.
The logic should be like this (the syntax is arbitrary, because I have never built an illustrator script myself):
const gc1 = getElementByGlobalColorName('global color 1')
gc1.changeCMYKcolorCode('20,
50,50,30')
After running that script, the color code of the global color 'global color 1' should change to:
Cyan = 20
Magenta = 50
Yellow = 50
Key = 30
The global color 1 needs to remain a global color. All objects/elements/layers that are connected to the global color 1 (and therefore have the same color as global color 1), should change their color as well (I think that's nothing the script should do, but it's a side-effect of Illustrator itself.)
If I select the global color 1 afterwards and change the color code manually, the linking between the objects/elements/layers and the global color should still be available.
I hope my lack of syntax and incorrect coding language will not confuse you. I appreciate any help a lot and would pay for a solution.
Thanks guys!
