Skip to content
ConsoleMonster
Struct

ThemeColor

ConsoleMonster.Styling

Namespace
ConsoleMonster.Styling
Assembly
ConsoleMonster
Base
ValueType
Modifiers
sealed

A theme colour with explicit fallbacks per colour tier. Automatic nearest-colour downsampling often turns carefully chosen RGB tones into muddy greys on a 16-colour console, so themes state the 16-colour (and optionally 256-colour) choice deliberately.

Inheritance

  • ValueType
  • ThemeColor

Usage

Explore 6 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 4

Accepted by parameters 2

Constructors

public ThemeColor(Color trueColor, int ansi16, int ansi256 = -1) #

Creates a theme colour.

Parameters

trueColor ConsoleMonster.Styling.Color required
The 24-bit colour.
ansi16 int required
The 16-colour index (0-15) to use on 16-colour terminals.
ansi256 int = -1 optional
The 256-colour index, or -1 to downsample trueColor automatically.

Methods

public static ThemeColor Hex(string hex, int ansi16, int ansi256 = -1) #

Creates a theme colour from a hex string and a 16-colour index.

Parameters

hex string required
The 24-bit colour as #rrggbb.
ansi16 int required
The 16-colour index.
ansi256 int = -1 optional
The 256-colour index or -1.

Returns

ThemeColor The theme colour.
public static ThemeColor PaletteIndex(int index) #

Creates a terminal palette reference (0-15) that remains an index at true colour depth.

Parameters

index int required

Returns

ThemeColor
public Color Resolve(ColorDepth depth) #

Returns the concrete colour for a colour depth.

Parameters

depth ConsoleMonster.Capabilities.ColorDepth required
The depth.

Returns

Color The colour to emit.

Properties

public Color TrueColor { get; } #

The 24-bit colour.

public bool IsPaletteIndex { get; } #

True when this colour keeps its terminal palette index at every colour depth.

public int Ansi16 { get; } #

The 16-colour index; -1 means the terminal default.

public int Ansi256 { get; } #

The 256-colour index; -1 means automatic.