Copy link to clipboard
Copied
Hi All,
Grateful for any help on the bellow please.
I can't get my text to change color using a variable reference. I have tried to convert a variable which comes from another comp and text frame into something that setFillColor on a text source will accept. It keeps saying 'bad argument'. I have tried with hex values and rgb values in various formats. It just won't seem to have a variable between the brackets in setFillColor.
Thanks,
Nick
var textcolor1 = toString(comp('vars').layer('text_color_1').text.sourceText); thisLayer.text.sourceText.style.setText(text1source).setFontSize(textfontSize1).setLeading(textlineHeight1).setFillColor(hexToRgb(textcolor1))
Copy link to clipboard
Copied
Converting the color to a string doesn't make any sense. Color functions expect a plain RGBA array and unless you generate the color info in obscure ways with custom code, all standard AE functions spit out the correct format already.
Mylenium
Copy link to clipboard
Copied
You just may need to add .value to your source text reference. This seems to work:
textColor1 = comp("vars").layer("text_color_1").text.sourceText.value;
style.setFillColor(hexToRgb(textColor1))
Copy link to clipboard
Copied
Thanks so much Dan! That was exactly it. Much apricated help.