diff options
author | Tibor Nagy <xnagytibor@gmail.com> | 2020-02-20 09:01:48 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-20 14:19:30 +0100 |
commit | c8bc53e98745e18a848a1456b0311015c8f93a35 (patch) | |
tree | 08a7b7cb379e0cb543f02b5d4b57c313086e2a67 | |
parent | 7592f9afd5bf1b794c125db14762707f969c0635 (diff) | |
download | serenity-c8bc53e98745e18a848a1456b0311015c8f93a35.zip |
LibGfx+LibGUI: Allow theming the text cursor
-rw-r--r-- | Base/res/themes/Dark.ini | 1 | ||||
-rw-r--r-- | Base/res/themes/Default.ini | 1 | ||||
-rw-r--r-- | Base/res/themes/Hotdog Stand.ini | 1 | ||||
-rw-r--r-- | Base/res/themes/Nord.ini | 1 | ||||
-rw-r--r-- | Base/res/themes/Xmas.ini | 1 | ||||
-rw-r--r-- | Libraries/LibGUI/TextEditor.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibGfx/Palette.h | 1 | ||||
-rw-r--r-- | Libraries/LibGfx/SystemTheme.cpp | 1 | ||||
-rw-r--r-- | Libraries/LibGfx/SystemTheme.h | 1 |
9 files changed, 9 insertions, 1 deletions
diff --git a/Base/res/themes/Dark.ini b/Base/res/themes/Dark.ini index 79d064d17c..efe09f223d 100644 --- a/Base/res/themes/Dark.ini +++ b/Base/res/themes/Dark.ini @@ -40,3 +40,4 @@ Ruler=#505050 RulerBorder=#666666 RulerActiveText=white RulerInactiveText=#d5d0c7 +TextCursor=#9c9cd5 diff --git a/Base/res/themes/Default.ini b/Base/res/themes/Default.ini index c844a38f8d..2114b678fe 100644 --- a/Base/res/themes/Default.ini +++ b/Base/res/themes/Default.ini @@ -40,3 +40,4 @@ Ruler=#d4d0c8 RulerBorder=#404040 RulerActiveText=#404040 RulerInactiveText=#808080 +TextCursor=red diff --git a/Base/res/themes/Hotdog Stand.ini b/Base/res/themes/Hotdog Stand.ini index f58488a506..7ae9ce82d8 100644 --- a/Base/res/themes/Hotdog Stand.ini +++ b/Base/res/themes/Hotdog Stand.ini @@ -40,3 +40,4 @@ Ruler=black RulerBorder=black RulerActiveText=yellow RulerInactiveText=white +TextCursor=black diff --git a/Base/res/themes/Nord.ini b/Base/res/themes/Nord.ini index c008ced779..103f02b6d2 100644 --- a/Base/res/themes/Nord.ini +++ b/Base/res/themes/Nord.ini @@ -40,3 +40,4 @@ Ruler=#434c5e RulerBorder=#3b4252 RulerActiveText=#95adc5 RulerInactiveText=#7e9dbc +TextCursor=#7e9dbc diff --git a/Base/res/themes/Xmas.ini b/Base/res/themes/Xmas.ini index 8634fdfcc7..764707623e 100644 --- a/Base/res/themes/Xmas.ini +++ b/Base/res/themes/Xmas.ini @@ -40,3 +40,4 @@ Ruler=#bcc1ae RulerBorder=#606060 RulerActiveText=#404040 RulerInactiveText=#808080 +TextCursor=#ee3532 diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp index a993a0b131..74774c79f5 100644 --- a/Libraries/LibGUI/TextEditor.cpp +++ b/Libraries/LibGUI/TextEditor.cpp @@ -496,7 +496,7 @@ void TextEditor::paint_event(PaintEvent& event) } if (is_focused() && m_cursor_state) - painter.fill_rect(cursor_content_rect(), Color::Red); + painter.fill_rect(cursor_content_rect(), palette().text_cursor()); } void TextEditor::toggle_selection_if_needed_for_event(const KeyEvent& event) diff --git a/Libraries/LibGfx/Palette.h b/Libraries/LibGfx/Palette.h index 73a500150d..eb3dd09dd4 100644 --- a/Libraries/LibGfx/Palette.h +++ b/Libraries/LibGfx/Palette.h @@ -98,6 +98,7 @@ public: Color ruler_border() const { return color(ColorRole::RulerBorder); } Color ruler_active_text() const { return color(ColorRole::RulerActiveText); } Color ruler_inactive_text() const { return color(ColorRole::RulerInactiveText); } + Color text_cursor() const { return color(ColorRole::TextCursor); } Color link() const { return color(ColorRole::Link); } Color active_link() const { return color(ColorRole::ActiveLink); } diff --git a/Libraries/LibGfx/SystemTheme.cpp b/Libraries/LibGfx/SystemTheme.cpp index 4985d0e29e..1a20055821 100644 --- a/Libraries/LibGfx/SystemTheme.cpp +++ b/Libraries/LibGfx/SystemTheme.cpp @@ -112,6 +112,7 @@ RefPtr<SharedBuffer> load_system_theme(const String& path) DO_COLOR(RulerBorder); DO_COLOR(RulerActiveText); DO_COLOR(RulerInactiveText); + DO_COLOR(TextCursor); buffer->seal(); buffer->share_globally(); diff --git a/Libraries/LibGfx/SystemTheme.h b/Libraries/LibGfx/SystemTheme.h index fca2c92ac6..8939090f65 100644 --- a/Libraries/LibGfx/SystemTheme.h +++ b/Libraries/LibGfx/SystemTheme.h @@ -75,6 +75,7 @@ enum class ColorRole { RulerBorder, RulerActiveText, RulerInactiveText, + TextCursor, __Count, |