Copy link to clipboard
Copied
Is there any simple way to convert an RGB color to and from other colors (e.g. HSL, Lab)?
I thought I had a way to have SolidColor do the conversion, but I can't seem to get it to work...
Does putting the solid color in the app's foreground then pulling back the other values not get you what you need? I don't do much of this so I could be a mile off…
var rgbSC = new SolidColor() rgbSC.rgb.red=0; rgbSC.rgb.green=204; rgbSC.rgb.blue=100; app.foregroundColor = rgbSC; $.writeln(app.foregroundColor.cmyk.cyan); $.writeln(app.foregroundColor.cmyk.magenta); $.writeln(app.foregroundColor.cmyk.yellow); $.writeln(app.foregroundColor.cmyk.black); $.writeln(app.foregroundColor.hsb.brightne
...Copy link to clipboard
Copied
Does putting the solid color in the app's foreground then pulling back the other values not get you what you need? I don't do much of this so I could be a mile off…
var rgbSC = new SolidColor() rgbSC.rgb.red=0; rgbSC.rgb.green=204; rgbSC.rgb.blue=100; app.foregroundColor = rgbSC; $.writeln(app.foregroundColor.cmyk.cyan); $.writeln(app.foregroundColor.cmyk.magenta); $.writeln(app.foregroundColor.cmyk.yellow); $.writeln(app.foregroundColor.cmyk.black); $.writeln(app.foregroundColor.hsb.brightness); $.writeln(app.foregroundColor.hsb.hue); $.writeln(app.foregroundColor.hsb.saturation);
Copy link to clipboard
Copied
That's what I was doing. I was just doing it with typos....
thanks...
Copy link to clipboard
Copied
You don't need to set the foreground color
var sc = new SolidColor;
sc.rgb.red = 200;
sc.rgb.green = 145;
sc.rgb.blue = 96;
$.writeln('RGB '+sc.rgb.red+':'+sc.rgb.green+':'+sc.rgb.blue);
$.writeln('Lab '+sc.lab.l+':'+sc.lab.a+':'+sc.lab.b);
$.writeln('HSB '+sc.hsb.hue+':'+sc.hsb.saturation+':'+sc.hsb.brightness);
$.writeln('CMYK '+sc.cmyk.cyan+':'+sc.cmyk.yellow+':'+sc.cmyk.magenta+':'+sc.cmyk.black);
Copy link to clipboard
Copied
Mike, Im convinced I tried that and it didn't work like I expected. I too will have to check on my typing…
Find more inspiration, events, and resources on the new Adobe Community
Explore Now