Set Label's custom font outline color

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BouncyBear

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

:bust_in_silhouette: Reply From: rakkarage

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

get_node("StatusInput").font.outline_modulate

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)

BouncyBear | 2020-07-27 18:19

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)

rakkarage | 2020-07-27 18:58

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)

BouncyBear | 2020-07-27 19:01

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

rakkarage | 2020-07-27 19:39

YES! now it’s working! :smiley:

Thank you very much for the help

BouncyBear | 2020-07-27 19:54

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).

Calinou | 2020-07-28 14:43

ty @rakkarage

label.get("custom_fonts/font").outline_color = Color(213, 55, 29, 255)

works, but it affects all instances, not the label I want to update

uralys | 2021-10-12 23:38