From 5be6a4386099ae3f6ad7f84ccba46a4076e1d381 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 26 Dec 2019 00:58:46 +0100 Subject: [PATCH] LibDraw: Add MenuBaseText and MenuSelectionText color roles This allows the very aesthetic "Hotdog Stand" theme to have quite reasonable looking menus. --- Base/res/themes/Dark.ini | 11 ++--------- Base/res/themes/Default.ini | 12 ++---------- Base/res/themes/Hotdog Stand.ini | 12 ++---------- Base/res/themes/Xmas.ini | 12 ++---------- Libraries/LibDraw/Palette.h | 2 ++ Libraries/LibDraw/SystemTheme.cpp | 2 ++ Libraries/LibDraw/SystemTheme.h | 2 ++ Servers/WindowServer/WSMenu.cpp | 6 +++--- 8 files changed, 17 insertions(+), 42 deletions(-) diff --git a/Base/res/themes/Dark.ini b/Base/res/themes/Dark.ini index adb65bb2dc..c42f855b5f 100644 --- a/Base/res/themes/Dark.ini +++ b/Base/res/themes/Dark.ini @@ -1,38 +1,31 @@ [Colors] DesktopBackground=#202020 - ActiveWindowBorder1=#3d3d4f ActiveWindowBorder2=#b7b7da ActiveWindowTitle=white - InactiveWindowBorder1=#606060 InactiveWindowBorder2=#a0a0a0 InactiveWindowTitle=#d5d0c7 - MovingWindowBorder1=#49496c MovingWindowBorder2=#9c9cd5 MovingWindowTitle=white - HighlightWindowBorder1=#a10d0d HighlightWindowBorder2=#fabbbb HighlightWindowTitle=white - MenuBase=#444444 +MenuBaseText=white MenuStripe=#323232 MenuSelection=#666666 - +MenuSelectionText=white Window=#323232 WindowText=white Button=#555555 ButtonText=white Base=#424242 BaseText=white - ThreedHighlight=#6f6f6f ThreedShadow1=#3d3e40 ThreedShadow2=#2e2f30 - HoverHighlight=#696969 - Selection=#14141a SelectionText=white diff --git a/Base/res/themes/Default.ini b/Base/res/themes/Default.ini index f9126edf72..344da69e61 100644 --- a/Base/res/themes/Default.ini +++ b/Base/res/themes/Default.ini @@ -1,39 +1,31 @@ [Colors] DesktopBackground=#404040 - ActiveWindowBorder1=#6e2209 ActiveWindowBorder2=#f4ca9e ActiveWindowTitle=white - InactiveWindowBorder1=#808080 InactiveWindowBorder2=#c0c0c0 InactiveWindowTitle=#d5d0c7 - MovingWindowBorder1=#a1320d MovingWindowBorder2=#fadcbb MovingWindowTitle=white - HighlightWindowBorder1=#a10d0d HighlightWindowBorder2=#fabbbb HighlightWindowTitle=white - MenuBase=white +MenuBaseText=black MenuStripe=#bbb7b0 MenuSelection=#ad714f - +MenuSelectionText=white Window=#d4d0c8 WindowText=black Button=#d4d0c8 ButtonText=black - Base=white BaseText=black - ThreedHighlight=white ThreedShadow1=#808080 ThreedShadow2=#404040 - HoverHighlight=#e3dfdb - Selection=#84351a SelectionText=white diff --git a/Base/res/themes/Hotdog Stand.ini b/Base/res/themes/Hotdog Stand.ini index e2a859e2a4..d1444849d7 100644 --- a/Base/res/themes/Hotdog Stand.ini +++ b/Base/res/themes/Hotdog Stand.ini @@ -1,39 +1,31 @@ [Colors] DesktopBackground=yellow - ActiveWindowBorder1=black ActiveWindowBorder2=black ActiveWindowTitle=white - InactiveWindowBorder1=red InactiveWindowBorder2=red InactiveWindowTitle=white - MovingWindowBorder1=black MovingWindowBorder2=black MovingWindowTitle=white - HighlightWindowBorder1=black HighlightWindowBorder2=black HighlightWindowTitle=white - MenuBase=white +MenuBaseText=black MenuStripe=red MenuSelection=#550000 - +MenuSelectionText=white Window=red WindowText=white Button=#c0c0c0 ButtonText=black - Base=red BaseText=white - ThreedHighlight=#a0a0a0 ThreedShadow1=#b0b0b0 ThreedShadow2=#909090 - HoverHighlight=white - Selection=black SelectionText=white diff --git a/Base/res/themes/Xmas.ini b/Base/res/themes/Xmas.ini index 28802585ce..4df9353458 100644 --- a/Base/res/themes/Xmas.ini +++ b/Base/res/themes/Xmas.ini @@ -1,39 +1,31 @@ [Colors] DesktopBackground=#313819 - ActiveWindowBorder1=#731013 ActiveWindowBorder2=#ee3532 ActiveWindowTitle=white - InactiveWindowBorder1=#734546 InactiveWindowBorder2=#ee908f InactiveWindowTitle=white - MovingWindowBorder1=#a76f24 MovingWindowBorder2=#eec666 MovingWindowTitle=white - HighlightWindowBorder1=#a76f24 HighlightWindowBorder2=#eec666 HighlightWindowTitle=white - MenuBase=#57691f +MenuBaseText=white MenuStripe=#2b3018 MenuSelection=#ff8742 - +MenuSelectionText=black Window=#5a0103 WindowText=white Button=#d46c64 ButtonText=black - Base=#d3d7c4 BaseText=black - ThreedHighlight=#e69e99 ThreedShadow1=#a24841 ThreedShadow2=#882d26 - HoverHighlight=#e6e5e2 - Selection=#84351a SelectionText=white diff --git a/Libraries/LibDraw/Palette.h b/Libraries/LibDraw/Palette.h index 2d5acf784f..4ee5816543 100644 --- a/Libraries/LibDraw/Palette.h +++ b/Libraries/LibDraw/Palette.h @@ -29,7 +29,9 @@ public: Color highlight_window_title() const { return color(ColorRole::HighlightWindowTitle); } Color menu_stripe() const { return color(ColorRole::MenuStripe); } Color menu_base() const { return color(ColorRole::MenuBase); } + Color menu_base_text() const { return color(ColorRole::MenuBaseText); } Color menu_selection() const { return color(ColorRole::MenuSelection); } + Color menu_selection_text() const { return color(ColorRole::MenuSelectionText); } Color base() const { return color(ColorRole::Base); } Color base_text() const { return color(ColorRole::BaseText); } Color button() const { return color(ColorRole::Button); } diff --git a/Libraries/LibDraw/SystemTheme.cpp b/Libraries/LibDraw/SystemTheme.cpp index 38178f9be4..77be0f5d9b 100644 --- a/Libraries/LibDraw/SystemTheme.cpp +++ b/Libraries/LibDraw/SystemTheme.cpp @@ -72,7 +72,9 @@ RefPtr load_system_theme(const String& path) DO_COLOR(HighlightWindowTitle); DO_COLOR(MenuStripe); DO_COLOR(MenuBase); + DO_COLOR(MenuBaseText); DO_COLOR(MenuSelection); + DO_COLOR(MenuSelectionText); buffer->seal(); buffer->share_globally(); diff --git a/Libraries/LibDraw/SystemTheme.h b/Libraries/LibDraw/SystemTheme.h index c5beb5a323..b1428e7594 100644 --- a/Libraries/LibDraw/SystemTheme.h +++ b/Libraries/LibDraw/SystemTheme.h @@ -21,7 +21,9 @@ enum class ColorRole { HighlightWindowTitle, MenuStripe, MenuBase, + MenuBaseText, MenuSelection, + MenuSelectionText, Window, WindowText, Button, diff --git a/Servers/WindowServer/WSMenu.cpp b/Servers/WindowServer/WSMenu.cpp index 7d09933a83..3711e5949d 100644 --- a/Servers/WindowServer/WSMenu.cpp +++ b/Servers/WindowServer/WSMenu.cpp @@ -154,11 +154,11 @@ void WSMenu::draw() for (auto& item : m_items) { if (item.type() == WSMenuItem::Text) { - Color text_color = palette.window_text(); + Color text_color = palette.menu_base_text(); if (&item == m_hovered_item && item.is_enabled()) { painter.fill_rect(item.rect(), palette.menu_selection()); painter.draw_rect(item.rect(), palette.menu_selection().darkened()); - text_color = Color::White; + text_color = palette.menu_selection_text(); } else if (!item.is_enabled()) { text_color = Color::MidGray; } @@ -190,7 +190,7 @@ void WSMenu::draw() s_submenu_arrow_bitmap_height }; submenu_arrow_rect.center_vertically_within(item.rect()); - painter.draw_bitmap(submenu_arrow_rect.location(), submenu_arrow_bitmap, palette.window_text()); + painter.draw_bitmap(submenu_arrow_rect.location(), submenu_arrow_bitmap, text_color); } } else if (item.type() == WSMenuItem::Separator) { Point p1(item.rect().translated(stripe_rect.width() + 4, 0).x(), item.rect().center().y() - 1);