Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Retrieve source text value to be used as color hex value

  • Retrieve source text value to be used as color hex value

    Posted by Christian Simpson on April 5, 2023 at 7:41 pm

    I am setting up mogrt templates using spreadsheet data. My goal is for a user to enter 6 digit hex value in the spreadsheet and for that value to be picked up in my mogrt. The only way I can think to do this is is to have some hidden text that receives the hex value from the spreadsheet that gets passed onto the color property. Maybe there is a better way?

    Brie Clayton replied 3 years, 3 months ago 4 Members · 4 Replies
  • 4 Replies
  • Yoan Boisjoli

    April 5, 2023 at 8:11 pm

    Hi Christian! I think you can add this expression to you color property and it should do the trick:

    hexColorSource = thisComp.layer("Hidden text").text.sourceText;

    hexColor = hexColorSource.value.toString();

    r = parseInt(hexColor.substring(0, 2), 16) / 255;

    g = parseInt(hexColor.substring(2, 4), 16) / 255;

    b = parseInt(hexColor.substring(4, 6), 16) / 255;

    [r, g, b, 1]

  • Dan Ebberts

    April 5, 2023 at 8:19 pm

    If your spreadsheet is a .csv file, I think you can go right to your hex data with a color expression like this:

    c = footage("hex color test.csv").dataValue([0,0]);
    hexToRgb(c)
  • Christian Simpson

    April 6, 2023 at 5:08 pm

    Thank you very much gentlemen, worked like a charm. Very much appreciated.

  • Brie Clayton

    April 7, 2023 at 1:30 am

    Thank you Dan and Yoan!

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