This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+8 votes
in Engine by (22 points)

6 Answers

+15 votes

get_node("Label").add_color_override("font_color", Color(1,0,0,1))

enter image description here

by (9,800 points)
+9 votes

Example

set("custom_colors/font_color",Color(1,0,0))

any parameter that doesn't have a direct getter or setter method can be accessed through
get(-the path hint you get when mousing over any parameter-)
e.g "custom_colors/font_color"

get() also needs a second parameter witch is what you want to change
e.g Color(1,0,0)

by (38 points)
edited by

Can you change a property of the color directly? e.g. the alpha? If so, how?

+3 votes

get_node("Label").set("custom_colors/default_color", Color(1,1,1,1))

The above would be white text.

by (24 points)

Thanks, this was very helpful. I assume things have been updated since 2017 as none of the other answers worked!

Thanks. It's a bit of trial and error sometimes. I'll try to contribute as much as I can. All the best!

+2 votes

I was able to change font color with modulate property.

lbl.modulate =  Color(1, 0, 1)
by (108 points)

I guess this works, but if the font color of the label isn't white, then the new color won't be the exact color displayed.

+1 vote

For Godot 4 the property path has changed.

$YourLabel.set("theme_override_colors/font_color", Color(1, 0, 0))

However, the approach I used to find this answer might also be helpful:

  1. Find the property you want to set in the editor node Inspector.
  2. Right-click the property label and select Copy Property Path.
  3. Set the property on your node using the copied path: <node>.set("<path>", <value>).

The challenge to understand which property to set remains. For example, I did not see the set color on my label because the Label Settings was set.

by (48 points)
edited by
+1 vote

In Godot 4

$Label.label_settings.font_color = Color.DARK_RED 
by (26 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.