0 votes

Hi,

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?

asked Feb 9 in Engine by dash3r (12 points)

1 Answer

0 votes

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...

answered Feb 9 by njamster (8,788 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.