-
If/Else statement to control text color
Hi Guys. I’m trying to write an If/Else statement to control the color of a text layer based on the color of a solid. In short, I want to either have the text be black if the solid color is on the lighter side or have the text be white if the solid color is on the darker side. I have a solid layer named “Solid 1” that has a color control effect on it and uses the sampleImage expression to determine it’s own color. I then have a text layer named “Text 1” with a Fill effect that has it’s color parameter pickwhipped to the color parameter of the color control effect on “Solid 1.” What that does is make “Text 1” the same color as “Solid 1.” Now I just need to add an If/Else statement within the Fill effect on Text 1 that says: if the color sample from solid one is above this brightness threshold then make this fill output = black (000000), else make this fill output = white (FFFFFF), but I don’t know how to accomplish that. Any help would be greatly appreciated!
Solid 1 has an Color Control effect with a color parameter named: “Color.” Here is the expression on that layer:
thisComp.layer("Solid 1").effect("Color Control")("Color")Text 1 has a Fill effect with a Color parameter named: “Color.” Here is the expression on that layer:
thisComp.layer("Solid 1").effect("Color Control")("Color")-Thanks,
Paul