question about modulate property

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dash3r


I am new to the engine, and currently im trying to change the color of a TextLabel on entering a keyword in the LineEdit box

On the properties tab of the TextLabel, I have noticed the property “modulate”. When I change the color in the editor, it seems to change the color correctly. However, in code it doesn’t seem to work properly (only get really thin red lines). This is what I used to modulate the color:

TextLabel.modulate = Color(255, 0, 0, 255)

After searching a bit, I found the solution to this problem by using:

TextLabel.add_color_override("font_color", Color(255, 0, 0, 255))

Even though this fixed my problem, I am still curious why this doesn’t work with modulate?

:bust_in_silhouette: Reply From: njamster

You’re using Color() wrong, the RGBA-values all have to be between 0.0 and 1.0:

TextLabel.modulate = Color(1.0, 0.0, 0.0, 1.0)

Why the Color-function accepts values above 1.0 is another question though…