From 0c8ff887b545d7424a64f11a5a0d494d47155173 Mon Sep 17 00:00:00 2001 From: Christian Kaiser Date: Fri, 26 Apr 2024 22:32:51 -0300 Subject: [PATCH] Improve Audio Bus button pressed state visibility --- editor/editor_audio_buses.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index b4e9faa4fdf..658bc33ddc0 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -87,9 +87,14 @@ void EditorAudioBus::_notification(int p_what) { disabled_vu = get_editor_theme_icon(SNAME("BusVuFrozen")); - Color solo_color = EditorThemeManager::is_dark_theme() ? Color(1.0, 0.89, 0.22) : Color(1.0, 0.92, 0.44); - Color mute_color = EditorThemeManager::is_dark_theme() ? Color(1.0, 0.16, 0.16) : Color(1.0, 0.44, 0.44); - Color bypass_color = EditorThemeManager::is_dark_theme() ? Color(0.13, 0.8, 1.0) : Color(0.44, 0.87, 1.0); + Color solo_color = EditorThemeManager::is_dark_theme() ? Color(1.0, 0.89, 0.22) : Color(1.9, 1.74, 0.83); + Color mute_color = EditorThemeManager::is_dark_theme() ? Color(1.0, 0.16, 0.16) : Color(2.35, 1.03, 1.03); + Color bypass_color = EditorThemeManager::is_dark_theme() ? Color(0.13, 0.8, 1.0) : Color(1.03, 2.04, 2.35); + float darkening_factor = EditorThemeManager::is_dark_theme() ? 0.15 : 0.65; + + Ref(solo->get_theme_stylebox("pressed"))->set_border_color(solo_color.darkened(darkening_factor)); + Ref(mute->get_theme_stylebox("pressed"))->set_border_color(mute_color.darkened(darkening_factor)); + Ref(bypass->get_theme_stylebox("pressed"))->set_border_color(bypass_color.darkened(darkening_factor)); solo->set_icon(get_editor_theme_icon(SNAME("AudioBusSolo"))); solo->add_theme_color_override("icon_pressed_color", solo_color); @@ -835,7 +840,13 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { child->add_theme_style_override("normal", sbempty); child->add_theme_style_override("hover", sbempty); child->add_theme_style_override("focus", sbempty); - child->add_theme_style_override("pressed", sbempty); + + Ref sbflat = memnew(StyleBoxFlat); + sbflat->set_content_margin_all(0); + sbflat->set_bg_color(Color(1, 1, 1, 0)); + sbflat->set_border_width(Side::SIDE_BOTTOM, Math::round(3 * EDSCALE)); + child->add_theme_style_override("pressed", sbflat); + child->end_bulk_theme_override(); }