Copy link to clipboard
Copied
Hi all, I am trying to write a script that will change the LAB values of a swatch.
I found out that Illustrator's API doesn't allow to directly change LAB values. e.g.
doc.swatches.getByName("MySwatchName").color.l = 42;
doc.swatches.getByName("MySwatchName").color.a += 1;
doc.swatches.getByName("MySwatchName").color.b -= 2;
This code above is impossible to execute.
So I tried converting the swatch to CMYK/RGB, then make the changes I need and right after, change it back to LAB.
So as a temporary solution, I would love to know what is the formula, if I need to change the B value by +1, or the L value by -1 or -2, what is the corresponding action I need to do with the CMYK color, to reach the LAB change I want.
As a permanent solution, I would LOVE to hear from Adobe if you are considering making LAB values accesible through the API directly, and if so, when will it be possible.
Copy link to clipboard
Copied
@ishay1999 check out this maybe it can help you
Copy link to clipboard
Copied
there's no need to ask multiple times (unless you're not the same user), check your other thread
Copy link to clipboard
Copied
Thank you, I did not see your answers for some reason through that other user.
Your code worked and helped me a lot. Thank you so much sir!
Copy link to clipboard
Copied
And this was me, the author from another user... Arrgh I get confused a lot in here lol