Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Turn RGB swatch into RGB values?

  • Turn RGB swatch into RGB values?

    Posted by William Marler on August 31, 2013 at 4:39 pm

    So I am doing a UI concept in which 3D planes move back and forth based on a colour value, sort of like a 3D colour graph.

    I want to link the position of the planes to the R, G, and B values of a layer’s fill colour, however RGB colour fills (such as in Effect>Generate>Fill) are only ever displayed as a swatch, not an RGB value. I have tried many effects, and all that provide a layer with a fill or change the colour in some way just have a swatch to determine colour, as opposed to separate values like you get in the colour picker, or in something like the HSL effect.

    Is it possible to “split” the swatch into the different values like you can split dimensions in the position parameter? If not, is there some way of changing the colour of a layer through RGB parameters as opposed to choosing a swatch with the colour picker.

    Thanks in advance.

    William Marler replied 12 years, 8 months ago 2 Members · 3 Replies
  • 3 Replies
  • Darby Edelen

    September 1, 2013 at 9:12 pm

    [William Marler] “Is it possible to “split” the swatch into the different values like you can split dimensions in the position parameter? If not, is there some way of changing the colour of a layer through RGB parameters as opposed to choosing a swatch with the colour picker.”

    You can do this with an expression. Color is stored as a 4 component array (or vector), so if you applied this to any Color Swatch you could produce different colors using RGB values:

    50% Gray:
    r = 0.5;
    g = 0.5;
    b = 0.5;
    a = 1.0;
    [r,g,b,a];

    100% Red:
    r = 1;
    g = 0;
    b = 0;
    a = 1.0;
    [r,g,b,a];

    Instead of manually entering the values into the expression you could aaply an Effect > Expression Controls > 3D Point Control and point the expression to those values for the RGB components (alpha will generally be 1.0):

    rgb = effect("3D Point Control")("3D Point");
    a = 1.0;
    rgb + [0,0,0,a];

    Note that internally all RGB values are in float (0.0 = black, 1.0 = white). If you wanted to supply 8 bit code values then you’d need to divide them by 255 to get the correct float value:

    rgb = effect("3D Point Control")("3D Point") / 255;
    a = 1.0;
    rgb + [0,0,0,a];

    Darby Edelen

  • William Marler

    September 6, 2013 at 6:06 pm

    Thank You Darby! Much appreciated, it’s always satisfying to link effects to sliders. 🙂

  • William Marler

    September 6, 2013 at 6:32 pm

    Just in case you are interested, I have achieved the effect slightly differently by adding three slider controls to the shape layer, to control R, G, and B respectively, and divided their values by 255, so now I can dial in the 255 RGB values to each individual slider. Thanks again!

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