summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorTibor Nagy <xnagytibor@gmail.com>2020-02-20 09:01:48 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-20 14:19:30 +0100
commitc8bc53e98745e18a848a1456b0311015c8f93a35 (patch)
tree08a7b7cb379e0cb543f02b5d4b57c313086e2a67 /Libraries
parent7592f9afd5bf1b794c125db14762707f969c0635 (diff)
downloadserenity-c8bc53e98745e18a848a1456b0311015c8f93a35.zip
LibGfx+LibGUI: Allow theming the text cursor
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibGUI/TextEditor.cpp2
-rw-r--r--Libraries/LibGfx/Palette.h1
-rw-r--r--Libraries/LibGfx/SystemTheme.cpp1
-rw-r--r--Libraries/LibGfx/SystemTheme.h1
4 files changed, 4 insertions, 1 deletions
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,