Copy link to clipboard
Copied
Hello, I am trying to figure out how to change a fill colour with code. For example, if I have a solid with a colour overlay of red how can I change this to another hex value? Many thanks.
hexToRgb(your color code here) into whatever property or effects control you want.
Mylenium
You just need to make sure you get the value of the sourceText:
var hexColor = thisComp.layer("TextLayer").text.sourceText.value;
hexToRgb(hexColor)
Copy link to clipboard
Copied
hexToRgb(your color code here) into whatever property or effects control you want.
Mylenium
Copy link to clipboard
Copied
Great, thanks. I was also trying to read the value from a text layer so I needed to convert it to a string otherwise it gave me an error...
var hexColorSource = thisComp.layer("TextLayer").text.sourceText;
var hexColor = hexColorSource.value.toString();
hexToRgb(hexColor)
Copy link to clipboard
Copied
You just need to make sure you get the value of the sourceText:
var hexColor = thisComp.layer("TextLayer").text.sourceText.value;
hexToRgb(hexColor)
Copy link to clipboard
Copied
Great, even better, thanks! I've been told off for "verbose code" before. 😆