-
Change font color of text that is between brackets (Inline color)
I have some dynamic elements I’m trying to get to work. I would like to change the font color of a word in a sentence that is between brackets. Also, the word between brackets should be the only one that changes color by a hex code. The hex code is provided by the user. So the text and text color would all be dynamic.
e.g input text is: Hello [Friend]
The word “friend” should then be in another color, which would be a color provided in a hex code.
In my project, I have 3 text layers: 2 input layers which are for the text and the hex code, and 1 output layer, which will display the final result.
At the moment I could only figure out, grabbing the input text to display in the Output layer, and the coloring.
var inputText = thisComp.layer("Input Text").text.sourceText;
inputText;This is on the Output layer, to which I added a Fill effect. The expression is on the Color property from the Fill:
var myColor = thisComp.layer("Input Color:").text.sourceText;
var rgb = hexToRgb(myColor);
rgb;So right now the text would be displayed as: Hello [Friend]
But what I would like is to have it display as: Hello Friend
And the word “friend” would be in the color of the hex code that the user will inputI hope my question is clear enough, and thanks in advance for your help!