ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: Hex Code from text?

COW Forums : Adobe After Effects Expressions

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index   •   Read entire thread


Scott McGee
Re: Hex Code from text?
on Sep 18, 2017 at 11:38:14 am

Dan Ebberts posted this a while back for someone else

hexColor = 0xfbd142;
r = (hexColor >> 16)/255;
g = ((hexColor & 0x00ff00) >> 8)/255;
b = (hexColor & 0xff)/255;
hsl = rgbToHsl([r,g,b,1]);

You could set up your "Text" layer (source text) add this to the expression

"0x" + text.sourceText;

Then when you copy and paste the hex code it will automatically add the 0x at front.

Then the above expression change to this.

hexColor = thisComp.layer("Text").text.sourceText;
r = (hexColor >> 16)/255;
g = ((hexColor & 0x00ff00) >> 8)/255;
b = (hexColor & 0xff)/255;
hsl = rgbToHsl([r,g,b,1]);


That should work for you.


Posts IndexRead Thread 


Current Message Thread:





© 2020 CreativeCOW.net All Rights Reserved
[TOP]