Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Rikitav/Terminality/llms.txt

Use this file to discover all available pages before exploring further.

Terminality represents terminal colors as the Color scoped enum defined in terminality:Color. It covers the standard 16-color palette supported by every VT-100-compatible terminal: one transparent sentinel, eight standard colors (including two grays), and their eight bright counterparts. You use Color values when setting foreground and background properties on controls and when issuing SetFore / SetBack commands inside RenderOverride.

Color values

EnumeratorValueDescription
Color::TRANSPARENT-1No color — inherits or leaves the cell color unchanged.
Color::BLACK0Standard black.
Color::DARK_BLUE1Standard dark blue.
Color::DARK_GREEN2Standard dark green.
Color::DARK_CYAN3Standard dark cyan.
Color::DARK_RED4Standard dark red.
Color::DARK_MAGENTA5Standard dark magenta.
Color::DARK_YELLOW6Standard dark yellow (often rendered as olive/brown).
Color::LIGHT_GRAY7Standard light gray (the default foreground on many terminals).
Color::DARK_GRAY8Bright black — dark gray.
Color::BLUE9Bright blue.
Color::GREEN10Bright green.
Color::CYAN11Bright cyan.
Color::RED12Bright red.
Color::MAGENTA13Bright magenta.
Color::YELLOW14Bright yellow.
Color::WHITE15Bright white.
The numeric values map directly to the Windows console attribute indices and to the standard ANSI 256-color palette entries 0–15, so they are portable across platforms Terminality supports.

Using colors on controls

Most controls expose four Property<> fields that accept Color:
PropertyDescription
ForegroundColorText color when the control is not focused.
BackgroundColorFill color when the control is not focused.
FocusedForegroundColorText color while the control holds keyboard focus.
FocusedBackgroundColorFill color while the control holds keyboard focus.
Assign them with the property assignment operator, which automatically triggers the appropriate invalidation:
auto* label = init<Label>([](Label* l)
{
    l->ForegroundColor        = Color::WHITE;
    l->BackgroundColor        = Color::DARK_BLUE;
    l->FocusedForegroundColor = Color::BLACK;
    l->FocusedBackgroundColor = Color::CYAN;
    l->Text = L"Hello, Terminality!";
});

Using colors in RenderOverride

Inside RenderOverride you obtain a RenderStream from context.BeginText() and pipe color commands into it with SetFore and SetBack:
void RenderOverride(RenderContext& context) override
{
    auto rin = context.BeginText();

    rin << SetBack(Color::BLACK);
    rin << SetFore(Color::LIGHT_GRAY) << message_.Timestamp;

    rin << SetFore(Color::CYAN);
    rin << " " << message_.Text;
}
SetFore changes the foreground (glyph) color; SetBack changes the background (cell fill) color. Both commands take effect for all characters written to the stream after the command.

Real example — MessageBubble rendering

The test application’s MessageBubble control uses focus state to swap the color scheme and the message’s isAuthor flag to tint the message body:
void RenderOverride(RenderContext& context) override
{
    auto rin = context.BeginText();
    if (focused_)
    {
        rin << SetBack(Color::WHITE);
        rin << SetFore(Color::DARK_GRAY) << message_.Timestamp;
    }
    else
    {
        rin << SetBack(Color::BLACK);
        rin << SetFore(Color::LIGHT_GRAY) << message_.Timestamp;
    }

    // Author messages appear in cyan; received messages in yellow
    rin << SetFore(message_.isAuthor ? Color::CYAN : Color::YELLOW);
    rin << " " << message_.Text;
}
This pattern — check focused_, then branch on Color values — is the standard idiom for focus-aware custom rendering in Terminality.

Build docs developers (and LLMs) love