1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 00:17:45 +00:00

LibVT: Implement bright color support

Previously, we only used bright colors when the bold attribute was set.
We now have the option to set it via escape sequences. We also needed to
make the bold text behavior optional, as some color schemes do weird
things with it. For example, Solarized uses it for various shades of
gray, so bold green would turn into a light shade of gray.

The following new escape sequences are supported:
- `CSI 90;m` to `CSI 97;m`: set bright foreground color
- `CSI 100;m` to `CSI 107;m`: set bright background color
This commit is contained in:
Daniel Bertalan 2021-06-03 17:26:25 +02:00 committed by Linus Groh
parent acbd1d14d0
commit 53099b216c
5 changed files with 56 additions and 12 deletions

View file

@ -83,6 +83,18 @@ public:
return m_value.as_named;
}
constexpr Color to_bright() const
{
if (is_named()) {
auto numeric_value = static_cast<u16>(as_named());
if (numeric_value < 8)
return Color::named(static_cast<ANSIColor>(numeric_value + 8));
return *this;
} else {
return *this;
}
}
constexpr bool operator==(const Color& other) const
{
if (m_kind != other.kind())