Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Converting color values

Advisor ,
Mar 21, 2011 Mar 21, 2011

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...

TOPICS
Actions and scripting
721
Translate
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

correct answers 1 Correct answer

Guide , Mar 21, 2011 Mar 21, 2011

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

...
Translate
Adobe
Guide ,
Mar 21, 2011 Mar 21, 2011

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);

Translate
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
Advisor ,
Mar 21, 2011 Mar 21, 2011

That's what I was doing. I was just doing it with typos....

thanks...

Translate
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
Guru ,
Mar 21, 2011 Mar 21, 2011

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);

Translate
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
Guide ,
Mar 21, 2011 Mar 21, 2011
LATEST

Mike, Im convinced I tried that and it didn't work like I expected. I too will have to check on my typing…

Translate
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