0 votes


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?

in Engine by (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...

by (10,582 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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.