1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:57:35 +00:00

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.
This commit is contained in:
Daniel Bertalan 2021-05-28 21:26:39 +02:00 committed by Linus Groh
parent 99033876ec
commit acbd1d14d0
6 changed files with 128 additions and 5 deletions

View file

@ -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 };