+1 vote

Using the suggestion in a previous question, I'm using .addcoloroverride() to change the color of my text through code. The issue is the method also seems to make the text bold and a bit hard to read. I'm wondering why it's not just changing the color, and if something can be done about it.

In the attached video, look at the top left label that says "ready" before and after the text changes.

func p1_laser_fired():
p1_laser.text = "Charging"
p1_laser.add_color_override("default_color", Color(255,0,0,255))

func p1_laser_ready():
p1_laser.text = "   Ready"
p1_laser.add_color_override("default_color", Color(0,255,0,255))

video

in Engine by (86 points)

1 Answer

+3 votes
Best answer

The color-component-values range from 0.0 to 1.0. Inserting values greater than 1.0 will result in overbright colors, which, if taken to the extreme,, will result in the color bleeding into the texts surrounding - like in your case.

So this will work:

func p1_laser_fired():
    p1_laser.text = "Charging"
    p1_laser.add_color_override("default_color", Color(1,0,0,1))

func p1_laser_ready():
    p1_laser.text = "   Ready"
    p1_laser.add_color_override("default_color", Color(0,1,0,1))
by (10,421 points)
selected by

This is the 2nd time in the past few days I've forgotten it's a range from 0.0 to 1.0. Thanks!

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.
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 webmaster@godotengine.org with your username.