summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVT/TerminalWidget.h
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2021-05-28 21:26:39 +0200
committerLinus Groh <mail@linusgroh.de>2021-06-04 09:02:43 +0100
commitacbd1d14d0ca8ea063a9acaec988913557acd22b (patch)
treec5b38b2d961a6e0dc96bce594159e8af9710ca4c /Userland/Libraries/LibVT/TerminalWidget.h
parent99033876ec6fc7484d7967d6cbd64f79669c21f7 (diff)
downloadserenity-acbd1d14d0ca8ea063a9acaec988913557acd22b.zip
LibVT+Terminal: Add color scheme support
This commit introduces color scheme support to Terminal. These are found in `/res/terminal_colors` and the default color scheme can be set in `~/.config/Terminal.ini`. Furthermore, a combo box is added for setting the color scheme at runtime. The previously used default color scheme has been added to `/res/terminal-colors/Default.ini`. To make the implementation more compatible with other color schemes, `TerminalWidget` now supports overriding the default foreground and background colors.
Diffstat (limited to 'Userland/Libraries/LibVT/TerminalWidget.h')
-rw-r--r--Userland/Libraries/LibVT/TerminalWidget.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibVT/TerminalWidget.h b/Userland/Libraries/LibVT/TerminalWidget.h
index 39d8a7f2e9..5d4307e651 100644
--- a/Userland/Libraries/LibVT/TerminalWidget.h
+++ b/Userland/Libraries/LibVT/TerminalWidget.h
@@ -81,6 +81,8 @@ public:
void paste();
void clear_including_history();
+ const StringView color_scheme_name() const { return m_color_scheme_name; }
+
Function<void(const StringView&)> on_title_change;
Function<void(const Gfx::IntSize&)> on_terminal_size_change;
Function<void()> on_command_exit;
@@ -91,6 +93,8 @@ public:
void set_font_and_resize_to_fit(const Gfx::Font&);
+ void set_color_scheme(const StringView&);
+
private:
// ^GUI::Widget
virtual void event(Core::Event&) override;
@@ -157,6 +161,12 @@ private:
// Snapshot of m_hovered_href when opening a context menu for a hyperlink.
String m_context_menu_href;
+ unsigned m_colors[256];
+ Gfx::Color m_default_foreground_color;
+ Gfx::Color m_default_background_color;
+
+ String m_color_scheme_name;
+
BellMode m_bell_mode { BellMode::Visible };
bool m_alt_key_held { false };
bool m_rectangle_selection { false };