0 votes

I'm trying to set a Label's (called StatusInput) custom font outline color. I am getting this error message: Invalid set index 'font_outline_modulate' (on base: 'Label') with value of type Color

And this is the code:

get_node("StatusInput").font_outline_modulate = Color(213, 55, 29, 255)

Thank you in advance for help

in Engine by (15 points)

1 Answer

+1 vote
Best answer

that message means that the function font_outline_modulate does not exist on Label

https://docs.godotengine.org/en/stable/classes/class_label.html

get_node("StatusInput").font.outline_modulate
by (1,647 points)
selected by

Don't think that works.

Now i get
Invalid get index 'font' (on base: 'Label')

Code:

get_node("StatusInput").font.outline_modulate = Color(213, 55, 29, 255)

ya sorry, it says font is a Theme property in the Label docs so maybe

get_node("StatusInput").theme.font.outline_modulate = Color(213, 55, 29, 255)

Still does not seem correct
I get Invalid get index 'font' (on base: 'null instance')

Code:

get_node("StatusInput").theme.font.outline_modulate = Color(213, 55, 29, 255)
get_node("StatusInput").get("custom_fonts/font").outline_color = Color(213, 55, 29, 255)

this seems to work

extends Control

onready var _label: Label = $Label

func _ready() -> void:
    var font = _label.get("custom_fonts/font")
    font.outline_color = Color.blue

enter image description here
enter image description here

YES! now it's working! :D

Thank you very much for the help

You probably meant Color8(213, 55, 29, 255). Color(213, 55, 29, 255) will result in a very overbright color that will most likely look like pure white. This is because Color uses floats in the 0..1 range (for non-overbright colors) whereas Color8 uses integers in the 0..255 range (no overbright colors possible).

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.

Categories