Changing LAB values - needs to be added to API

New Here ,
Nov 30, 2021 Nov 30, 2021

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.

TOPICS
Feature request , Scripting , SDK

Views

68

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 30, 2021 Nov 30, 2021

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 30, 2021 Nov 30, 2021

Copy link to clipboard

Copied

there's no need to ask multiple times (unless you're not the same user), check your other thread

 

https://community.adobe.com/t5/illustrator-discussions/how-do-i-change-values-of-lab-colors-in-illus...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 30, 2021 Nov 30, 2021

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!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 30, 2021 Nov 30, 2021

Copy link to clipboard

Copied

LATEST

And this was me, the author from another user... Arrgh I get confused a lot in here lol

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines