Godot - Changing the Text Color of a Button on Focus and Press
This code example shows how to change the text color of a Button node on focus and press using GDScript.
You can change the text color of a Button node on focus and press using `add_theme_color_override()
`.
Use `font_hover_color` to specify the text color when the button is focused, and `font_pressed_color` to specify the text color when the button is pressed.
# Create a Button node
var button = Button.new()
add_child(button)
button.text = "Button"
# Text color on focus
button.add_theme_color_override("font_hover_color", Color("#F00", 1))
# Text color when pressed
button.add_theme_color_override("font_pressed_color", Color("#000", 1))
TitleGodot - Changing the Text Color of a Button on Focus and Press
CategoryGodot
Created
Update
AuthorYousuke.U