Theme
ConsoleMonster.Styling
The built-in ITheme implementation: a table of ThemeStyle per token. Themes are immutable; Theme.With returns a modified copy.
Inheritance
- object
- Theme
Usage
Explore 12 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 12
- Method Theme.FromName
- Method Theme.FromScheme
- Method Theme.Rename
- Method Theme.With
- Method Theme.WithAppearance
- Property Theme.ColorBlindSafe
- Property Theme.ColorBlindSafeLight
- Property Theme.Dark
- Property Theme.HighContrast
- Property Theme.Light
- Property Theme.Terminal
- Method ThemeFile.ToTheme
Constructors
public Theme(string name, IReadOnlyDictionary<ThemeToken, ThemeStyle> styles) #Creates a theme from a complete token table.
Parameters
- name string
- The theme name.
- styles System.Collections.Generic.IReadOnlyDictionary<ConsoleMonster.Styling.ThemeToken, ConsoleMonster.Styling.ThemeStyle>
- Styles per token; tokens without an entry render with the terminal default.
public Theme(string name, IReadOnlyDictionary<ThemeToken, ThemeStyle> styles, ThemeAppearance? appearance) #Creates a theme from a complete token table and a style.
Parameters
- name string
- The theme name.
- styles System.Collections.Generic.IReadOnlyDictionary<ConsoleMonster.Styling.ThemeToken, ConsoleMonster.Styling.ThemeStyle>
- Styles per token; tokens without an entry render with the terminal default.
- appearance ConsoleMonster.Styling.ThemeAppearance?
- Frames, status markers and background; null uses ThemeAppearance.Default.
Methods
public static Theme FromName(string? name) #Returns a built-in theme, catalogue scheme or paired family by name, or Theme.Dark for an unknown name.
Parameters
- name string?
- The name.
public static Theme FromScheme(TerminalScheme scheme, bool accessible = false) #Derives semantic roles from one scheme. Faithful colours are chosen without adjustment; accessibility uses ThemeCheck's measurements.
Parameters
- scheme ConsoleMonster.Styling.TerminalScheme
- accessible bool = false
Returns
Themepublic ThemeStyle Get(ThemeToken token) #Returns the definition of a token.
Parameters
- token ConsoleMonster.Styling.ThemeToken
- The token.
public Theme Rename(string name) #Returns a copy of the theme under a new name.
Parameters
- name string
- The name.
public Style Resolve(ThemeToken token, ColorDepth depth) #Resolves a token to a concrete style for a colour depth.
Parameters
- token ConsoleMonster.Styling.ThemeToken
- The token.
- depth ConsoleMonster.Capabilities.ColorDepth
- The colour depth being rendered.
public static bool TryParseToken(string name, out ThemeToken token) #Parses a token name case-insensitively (pass, Muted, series3).
Parameters
- name string
- The name.
- token ConsoleMonster.Styling.ThemeToken
- The token.
Returns
bool Whether the name is a known token.public bool TryResolve(string name, ColorDepth depth, out Style style) #Resolves a token by name (case-insensitive), as used in markup such as [pass].
Parameters
- name string
- Token name, for example pass or muted.
- depth ConsoleMonster.Capabilities.ColorDepth
- The colour depth being rendered.
- style ConsoleMonster.Styling.Style
- The resolved style.
Returns
bool Whether the name is a token of this theme.public Theme With(ThemeToken token, ThemeStyle style) #Returns a copy of the theme with one token replaced.
Parameters
- token ConsoleMonster.Styling.ThemeToken
- The token.
- style ConsoleMonster.Styling.ThemeStyle
- The new definition.
public Theme WithAppearance(ThemeAppearance appearance) #Returns a copy of the theme with another style.
Parameters
- appearance ConsoleMonster.Styling.ThemeAppearance
- The style.
Inherited Methods
Properties
public static Theme Dark { get; } #The default theme, tuned for dark terminal backgrounds (Windows Terminal, conhost, VS Code dark).
public static Theme HighContrast { get; } #A high-contrast theme: saturated primaries, bold status, white borders.
public static Theme ColorBlindSafe { get; } #A dark-background preset for red-green colour blindness: blue pass, rose fail, yellow warning, explicit low-colour fallbacks and bold/underlined emphasis. Widgets retain their status labels and glyphs in every colour tier.
public static Theme ColorBlindSafeLight { get; } #The light-background counterpart of Theme.ColorBlindSafe: blue pass, magenta fail, dark gold warning.
public static IReadOnlyList<ThemeScheme> Schemes { get; } #The shipped colour schemes, with explicit names, family, background variant and display labels.
public ThemeAppearance Appearance { get; } #The style beside the colours: frames, status markers and the background the theme is made for.
public TerminalScheme? Scheme { get; private set; } #The source scheme, when this theme was derived from a terminal scheme.
public bool IsAccessible { get; private set; } #Whether the source scheme uses the accessible derivation.
public IReadOnlyList<ThemeToken> AdjustedTokens { get; private set; } #Tokens whose colours were moved in OKLCH to meet contrast or colour-vision requirements.
public bool FollowsTerminal { get; private set; } #Whether this theme follows live terminal palette indexes.
public static Theme Terminal { get; } #Follows the terminal's sixteen palette colours at every colour depth, including true colour.