Skip to main content

TermColor class

Namespace: Arlecchino.Rendering.Colors · Assembly: Arlecchino.Core

A style built from the sixteen-color palette. This is what the roles on Theme are made of and what chrome should use, because those colors follow the terminal's own theme.

public sealed class TermColor : IArlecchinoColor

Implements IArlecchinoColor

Constructors

MemberSummary
TermColor()

Properties

MemberSummary
AnsiThe escape sequence for this style, built once and rebuilt only if TerminalCapabilities.Color changes. Empty when color is turned off.
BackgroundColor behind the glyphs. TerminalColor.Default leaves it to the terminal.
ExactBackgroundThe same for what is behind the glyphs, falling back to TermColor.Background.
ExactForegroundAn exact color for the glyphs, used where the terminal can do 24-bit. Set TermColor.Foreground as well, and it becomes the chosen fallback rather than the nearest one arithmetic finds.
ForegroundColor of the glyphs. TerminalColor.Default leaves it to the terminal.
StyleBold, italic, underline and dim, in any combination.

Methods

MemberSummary
ToString()Writes the style as the sequence that puts it in force, so it can be appended directly.

Constructors in detail

TermColor()

public TermColor();

Properties in detail

Ansi

public string Ansi { get; }

The escape sequence for this style, built once and rebuilt only if TerminalCapabilities.Color changes. Empty when color is turned off.

Type string

Background

public TerminalColor Background { get; init; }

Color behind the glyphs. TerminalColor.Default leaves it to the terminal.

Type TerminalColor

ExactBackground

public Nullable<Rgb> ExactBackground { get; init; }

The same for what is behind the glyphs, falling back to TermColor.Background.

Type Nullable<T><Rgb>

ExactForeground

public Nullable<Rgb> ExactForeground { get; init; }

An exact color for the glyphs, used where the terminal can do 24-bit. Set TermColor.Foreground as well, and it becomes the chosen fallback rather than the nearest one arithmetic finds.

Type Nullable<T><Rgb>

Foreground

public TerminalColor Foreground { get; init; }

Color of the glyphs. TerminalColor.Default leaves it to the terminal.

Type TerminalColor

Style

public TextStyle Style { get; init; }

Bold, italic, underline and dim, in any combination.

Type TextStyle

Methods in detail

ToString()

public override string ToString();

Writes the style as the sequence that puts it in force, so it can be appended directly.

Returns stringTermColor.Ansi.