diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-26 17:34:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 17:34:07 +0200 |
commit | 344babb939194f50b83dee5dc051862447f27059 (patch) | |
tree | fea4cabe1ba8441f2b6e6f05cbf1352488dc5b0d /scene/gui/button.cpp | |
parent | 46a139a3cefe1d57172c36118ec8a151a4cf2920 (diff) | |
parent | 12838bd99dbb784ace55e4537eaebabeb435880a (diff) |
Merge pull request #54267 from pycbouh/controls-button-font-focus
Diffstat (limited to 'scene/gui/button.cpp')
-rw-r--r-- | scene/gui/button.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index e253a27e66..9818c8f0cc 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -111,9 +111,18 @@ void Button::_notification(int p_what) { if (!flat) { style->draw(ci, Rect2(Point2(0, 0), size)); } - color = get_theme_color(SNAME("font_color")); - if (has_theme_color(SNAME("icon_normal_color"))) { - color_icon = get_theme_color(SNAME("icon_normal_color")); + + // Focus colors only take precedence over normal state. + if (has_focus()) { + color = get_theme_color(SNAME("font_focus_color")); + if (has_theme_color(SNAME("icon_focus_color"))) { + color_icon = get_theme_color(SNAME("icon_focus_color")); + } + } else { + color = get_theme_color(SNAME("font_color")); + if (has_theme_color(SNAME("icon_normal_color"))) { + color_icon = get_theme_color(SNAME("icon_normal_color")); + } } } break; case DRAW_HOVER_PRESSED: { |