Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Instantiating a color via expressions: possible?

  • Instantiating a color via expressions: possible?

    Posted by Michael Mendelsohn on November 6, 2013 at 4:41 pm

    Using expressions, I can create a color reference by pick-whipping a color control and the result is:
    var myColor = rgbToHsl(effect("Color Control")("Color"));
    But, I want to avoid using a color control, and simply instantiate the color with a variable:
    var myColor = rgbToHsl([159,27,41,1]);
    …but this doesn’t seem to work. Is it possible?

    Michael Mendelsohn replied 12 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Kevin Camp

    November 6, 2013 at 8:05 pm

    your rgb values need to be in values 0-1 rather than 0-255. so if you want to stick with entering 0-255 values you just need to divide that array by 255…

    var myColor = rgbToHsl([159,27,41,255]/255);

    note, i did assume that you wante the alpha component to be full (255) not 1. if i guessed wrong, change the alpha back to 1.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Michael Mendelsohn

    November 6, 2013 at 9:26 pm

    Brilliant, thank you Kevin!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy