diff options
author | 0xtechnobabble <0xtechnobabble@protonmail.com> | 2020-01-06 01:47:55 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-07 11:02:43 +0100 |
commit | 123dcada05ca5acf2143fe11e9229eb113b99199 (patch) | |
tree | ae97902b003bab2d2fc75f06dd6508355b1d28e1 | |
parent | 56a2c21e0c9177ce8ee66fee66eaaa497b6dfcb6 (diff) | |
download | serenity-123dcada05ca5acf2143fe11e9229eb113b99199.zip |
Themes: Support rubberband selection theming
-rw-r--r-- | Base/res/themes/Dark.ini | 2 | ||||
-rw-r--r-- | Base/res/themes/Default.ini | 2 | ||||
-rw-r--r-- | Base/res/themes/Hotdog Stand.ini | 2 | ||||
-rw-r--r-- | Base/res/themes/Xmas.ini | 2 | ||||
-rw-r--r-- | DevTools/HackStudio/CursorTool.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibDraw/Palette.h | 3 | ||||
-rw-r--r-- | Libraries/LibDraw/SystemTheme.cpp | 8 | ||||
-rw-r--r-- | Libraries/LibDraw/SystemTheme.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/GItemView.cpp | 4 |
9 files changed, 22 insertions, 7 deletions
diff --git a/Base/res/themes/Dark.ini b/Base/res/themes/Dark.ini index c42f855b5f..2130d03681 100644 --- a/Base/res/themes/Dark.ini +++ b/Base/res/themes/Dark.ini @@ -29,3 +29,5 @@ ThreedShadow2=#2e2f30 HoverHighlight=#696969 Selection=#14141a SelectionText=white +RubberBandFill=#8080803c +RubberBandBorder=black diff --git a/Base/res/themes/Default.ini b/Base/res/themes/Default.ini index 344da69e61..da38dec0e1 100644 --- a/Base/res/themes/Default.ini +++ b/Base/res/themes/Default.ini @@ -29,3 +29,5 @@ ThreedShadow2=#404040 HoverHighlight=#e3dfdb Selection=#84351a SelectionText=white +RubberBandFill=#f4ca9e3c +RubberBandBorder=#6e2209 diff --git a/Base/res/themes/Hotdog Stand.ini b/Base/res/themes/Hotdog Stand.ini index d1444849d7..65856c1823 100644 --- a/Base/res/themes/Hotdog Stand.ini +++ b/Base/res/themes/Hotdog Stand.ini @@ -29,3 +29,5 @@ ThreedShadow2=#909090 HoverHighlight=white Selection=black SelectionText=white +RubberBandFill=#fad7653c +RubberBandBorder=#f4ca9e diff --git a/Base/res/themes/Xmas.ini b/Base/res/themes/Xmas.ini index 4df9353458..7f19071cfc 100644 --- a/Base/res/themes/Xmas.ini +++ b/Base/res/themes/Xmas.ini @@ -29,3 +29,5 @@ ThreedShadow2=#882d26 HoverHighlight=#e6e5e2 Selection=#84351a SelectionText=white +RubberBandFill=#0466033c +RubberBandBorder=#76943c diff --git a/DevTools/HackStudio/CursorTool.cpp b/DevTools/HackStudio/CursorTool.cpp index b8450073f2..83ddfaeafe 100644 --- a/DevTools/HackStudio/CursorTool.cpp +++ b/DevTools/HackStudio/CursorTool.cpp @@ -154,6 +154,6 @@ void CursorTool::on_second_paint(GPainter& painter, GPaintEvent&) if (!m_rubber_banding) return; auto rect = rubber_band_rect(); - painter.fill_rect(rect, Color(244, 202, 158, 60)); - painter.draw_rect(rect, Color(110, 34, 9)); + painter.fill_rect(rect, m_editor.palette().rubber_band_fill()); + painter.draw_rect(rect, m_editor.palette().rubber_band_border()); } diff --git a/Libraries/LibDraw/Palette.h b/Libraries/LibDraw/Palette.h index af04aef659..52d375fdec 100644 --- a/Libraries/LibDraw/Palette.h +++ b/Libraries/LibDraw/Palette.h @@ -60,8 +60,11 @@ public: Color threed_shadow1() const { return color(ColorRole::ThreedShadow1); } Color threed_shadow2() const { return color(ColorRole::ThreedShadow2); } Color hover_highlight() const { return color(ColorRole::ThreedHighlight); } + Color rubber_band_fill() const { return color(ColorRole::RubberBandFill); } + Color rubber_band_border() const { return color(ColorRole::RubberBandBorder); } Color color(ColorRole role) const { return m_impl->color(role); } + void set_color(ColorRole, Color); const SystemTheme& theme() const { return m_impl->theme(); } diff --git a/Libraries/LibDraw/SystemTheme.cpp b/Libraries/LibDraw/SystemTheme.cpp index 77be0f5d9b..24cdf356df 100644 --- a/Libraries/LibDraw/SystemTheme.cpp +++ b/Libraries/LibDraw/SystemTheme.cpp @@ -32,17 +32,17 @@ RefPtr<SharedBuffer> load_system_theme(const String& path) auto* data = (SystemTheme*)buffer->data(); - auto get = [&](auto& name) { + auto get_color = [&](auto& name) { auto color_string = file->read_entry("Colors", name); auto color = Color::from_string(color_string); if (!color.has_value()) return Color(Color::Black); - dbg() << "Parsed system color '" << name << "' = " << color.value(); + dbg() << "Parsed system theme color '" << name << "' = " << color.value(); return color.value(); }; #define DO_COLOR(x) \ - data->color[(int)ColorRole::x] = get(#x) + data->color[(int)ColorRole::x] = get_color(#x) DO_COLOR(DesktopBackground); DO_COLOR(ThreedHighlight); @@ -75,6 +75,8 @@ RefPtr<SharedBuffer> load_system_theme(const String& path) DO_COLOR(MenuBaseText); DO_COLOR(MenuSelection); DO_COLOR(MenuSelectionText); + DO_COLOR(RubberBandFill); + DO_COLOR(RubberBandBorder); buffer->seal(); buffer->share_globally(); diff --git a/Libraries/LibDraw/SystemTheme.h b/Libraries/LibDraw/SystemTheme.h index b075156a0f..74d3d90c44 100644 --- a/Libraries/LibDraw/SystemTheme.h +++ b/Libraries/LibDraw/SystemTheme.h @@ -36,6 +36,8 @@ enum class ColorRole { HoverHighlight, Selection, SelectionText, + RubberBandFill, + RubberBandBorder, __Count, diff --git a/Libraries/LibGUI/GItemView.cpp b/Libraries/LibGUI/GItemView.cpp index f4cb899ac4..d7b64c24b3 100644 --- a/Libraries/LibGUI/GItemView.cpp +++ b/Libraries/LibGUI/GItemView.cpp @@ -260,8 +260,8 @@ void GItemView::second_paint_event(GPaintEvent& event) painter.add_clip_rect(event.rect()); auto rubber_band_rect = Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current); - painter.fill_rect(rubber_band_rect, Color(244, 202, 158, 60)); - painter.draw_rect(rubber_band_rect, Color(110, 34, 9)); + painter.fill_rect(rubber_band_rect, parent_widget()->palette().rubber_band_fill()); + painter.draw_rect(rubber_band_rect, parent_widget()->palette().rubber_band_border()); } void GItemView::paint_event(GPaintEvent& event) |