From 6059cf259464bd826f4ee98ea68acc3237272642 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Wed, 12 Oct 2022 18:19:52 -0300 Subject: [PATCH] Expose various color themes for `Button` --- doc/classes/Button.xml | 21 +++++++++++++++++++ .../resources/default_theme/default_theme.cpp | 8 +++++++ 2 files changed, 29 insertions(+) diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml index 9e30081bf1f..a520fbbd0fb 100644 --- a/doc/classes/Button.xml +++ b/doc/classes/Button.xml @@ -74,9 +74,30 @@ Text [Color] used when the [Button] is being hovered. + + Text [Color] used when the [Button] is being hovered and pressed. + Text [Color] used when the [Button] is being pressed. + + Icon modulate [Color] used when the [Button] is disabled. + + + Icon modulate [Color] used when the [Button] is focused. Only replaces the normal modulate color of the button. Disabled, hovered, and pressed states take precedence over this color. + + + Icon modulate [Color] used when the [Button] is being hovered. + + + Icon modulate [Color] used when the [Button] is being hovered and pressed. + + + Default icon modulate [Color] of the [Button]. + + + Icon modulate [Color] used when the [Button] is being pressed. + The horizontal space between [Button]'s icon and text. diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 8a0fa2b6945..0e18ab4b1d6 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -238,9 +238,17 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_color("font_color", "Button", control_font_color); theme->set_color("font_color_pressed", "Button", control_font_color_pressed); theme->set_color("font_color_hover", "Button", control_font_color_hover); + theme->set_color("font_color_hover_pressed", "Button", control_font_color_pressed); theme->set_color("font_color_focus", "Button", control_font_color_focus); theme->set_color("font_color_disabled", "Button", control_font_color_disabled); + theme->set_color("icon_color_normal", "Button", Color(1, 1, 1, 1)); + theme->set_color("icon_color_pressed", "Button", Color(1, 1, 1, 1)); + theme->set_color("icon_color_hover", "Button", Color(1, 1, 1, 1)); + theme->set_color("icon_color_hover_pressed", "Button", Color(1, 1, 1, 1)); + theme->set_color("icon_color_focus", "Button", Color(1, 1, 1, 1)); + theme->set_color("icon_color_disabled", "Button", Color(1, 1, 1, 0.4)); + theme->set_constant("hseparation", "Button", 2 * scale); // LinkButton