0 votes

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

asked Jun 21 in Engine by TheJollyReaper (56 points)

1 Answer

+2 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))
answered Jun 21 by njamster (8,986 points)
selected Jun 21 by TheJollyReaper

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.