Godot Version
4.3
Question
I tried to change the colors of a button via “add_theme_color_override()”.
But the colors doesn’t change.
The Button has a Theme attached and in the inspector window, the style override’s are empty.
Script:
func _on_Size_button_focus(SizeMenu_button: Button):
# override colors
var size_button = $Menus/HBoxContainer/VBoxContainer/SizeOptionButtonContainer/SizeOptionButton
var focus_color = GlobalOptions.menu_canvas_color_focus
var normal_color = GlobalOptions.menu_canvas_color_focus
size_button.add_theme_color_override("focus", focus_color)
size_button.add_theme_color_override("normal", normal_color)
print(size_button.get_theme_color("focus")) # Sollte focus_color ausgeben
print(size_button.get_theme_color("normal")) # Sollte normal_color ausgeben
Global Variable:
var menu_canvas_color_focus: Color = Color(0.004, 0.18, 0.251, 1.0) # #012E40
print shows:
(0.004, 0.18, 0.251, 1)
(0.004, 0.18, 0.251, 1)
The Print shows the right Color, but there is no visual change ingame.
What did i do wrong?