Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Controlling color with checkbox controller

  • Controlling color with checkbox controller

  • Christian Simpson

    September 5, 2017 at 11:43 pm

    I was wondering if there was a way to control the color values used with the Fill effect based on whether a checkbox was checked or not. For example if i had a solid with the fill effect applied and I had an adjustment layer with 32 different checkboxes. One checkbox could be named Red, the other Blue and so on. Is there a way depending on which checkbox I check that the color values I assign in the expression become active? In other words multiple instances of if/else?

  • Dan Ebberts

    September 6, 2017 at 6:31 am

    Sure, here’s a simple example with 5 colors:

    L = thisComp.layer("Controls");
    else if (L.effect("Green")("Checkbox").value)
    else if (L.effect("Blue")("Checkbox").value)
    else if (L.effect("Yellow")("Checkbox").value)
    else if (L.effect("Orange")("Checkbox").value)


  • Christian Simpson

    September 6, 2017 at 5:59 pm

    You’re wonderful Dan, thank you very much for your expertise. Worked like a charm

  • Connor Betts

    August 8, 2020 at 6:50 pm

    I realize this is an older post, but I’m attempting to do the same thing. A toggle between two colors. However I can’t figure out the color system this is using. I’ve spent a while looking around online and I can’t find an answer.

    Is there a way to do this with a hex code or rgb values?


  • Dan Ebberts

    August 8, 2020 at 7:24 pm

    The color channels are normalized to be between zero and one. You could use 0-255 values like this (example for yellow):



  • Chaz Chester

    August 9, 2020 at 1:53 am

    You can also convert hex to this format using this expression that Dan Ebberts and Scott McGee figured out:

    txt = “FFFFFF”; //the hex code
    hex = parseInt(txt,16);
    r = hex >> 16;
    g = (hex & 0x00ff00) >> 8;
    b = hex & 0xff;

  • Connor Betts

    August 9, 2020 at 2:34 pm

    Thanks! This worked for me, i was missing dividing it by 255 when i was trying it.

  • Connor Betts

    August 9, 2020 at 2:34 pm

    Thanks, this is good to know! It worked.

Viewing 1 - 8 of 8 posts

Log in to reply.

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