Label text color issues

Godot Version

4.2.1

Question

I have been trying to make a simple platformer. For this, I need to change the color of text of a label. Here is my code and one of my error messages.


I have tried almost everything and nothing has worked. Any ideas are helpful.

You can try this:

var label_settings = LabelSettings.new()
label_settings.font_color = color
get_node(nodePath).label_settings = label_settings

That didn’t quite work, and it sized down all the labels that reference that code, probably because I use text size to size up the labels.

I was testing some things, and I decided to hard code everything to be Color(0,0,0), which made everything black. I tested Color(77,77,77) which made everything white, although that hex is a gray. I looked into the Color class and looked at it’s constructors. Color(r,g,b) returns a Color object with values r, g, and b being 0-1. As I was setting everything to 77,77,77, that would limit to 1,1,1 which is white. To fix this, try using Color8(r,g,b) instead.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.