+1 vote

In the object inspector I can change color separately the taken Label.
enter image description here

But I don't see a method to do that in GDScript. Tell me how to do it in GDScript.

asked Jun 12, 2016 in Engine by DimitriyPS (353 points)

1 Answer

+4 votes
Best answer
label.add_color_override("font_color", Color(1,0,0,1))
answered Jun 12, 2016 by volzhs (9,483 points)
selected Jun 12, 2016 by DimitriyPS

Is it safe to call this multiple times? The add naming confuses me :s
Also, how can I get this color? When I use get_color("font_color") it returns white instead of what I set in the editor...

how can we remove the color_override?

@Zylann

var color = get_node("Label").get("custom_colors/font_color")   

@digitalsin

get_node("Label").set("custom_colors/font_color", null)
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.