Table of Contents

Class TigerConsole

Namespace
ItTiger.TigerCli.Terminal
Assembly
ItTiger.TigerCli.dll
Static entry point for TigerCli console output, markup rendering, structured rendering, themes, colour mode, and test/documentation capture helpers.
public static class TigerConsole
Inheritance
TigerConsole
Inherited Members

Properties

ColorAliases

The active raw colour alias registry consulted by markup in raw colour positions. Defaults to an empty registry — TigerCli ships no built-in colour aliases. Cannot be set to null.
public static TigerColorAliasRegistry ColorAliases { get; set; }

Property Value

TigerColorAliasRegistry

ColorMode

The process-global colour mode for TigerCli's default console output paths (RenderGrid(CliGrid), Markup(string), MarkupError(string)). Defaults to Auto. Like CurrentTheme, this is a process-wide setting; tests that change it should restore the previous value in a finally. The full-interactive TUI is unaffected and continues to use the legacy console sink.
public static CliColorMode ColorMode { get; set; }

Property Value

CliColorMode

CurrentTheme

The theme used for themed output when no explicit theme is passed. Defaults to the registered DarkTheme; cannot be set to null. May be set to any ITheme, including a custom theme that is not registered (lookup by name still only finds registered themes, but GetTheme("default") always returns this value).
public static ITheme CurrentTheme { get; set; }

Property Value

ITheme

CustomStyles

The active custom semantic style registry consulted by markup for single-token tags that are not framework semantic tokens. Defaults to an empty registry. Cannot be set to null.
public static TigerCustomStyleRegistry CustomStyles { get; set; }

Property Value

TigerCustomStyleRegistry

HyperlinkMode

The process-global OSC 8 hyperlink emission mode for TigerCli's default console output paths. Defaults to Auto. Clickability is a progressive enhancement — link text is always written visibly/copyably regardless of this setting; this only controls whether an AnsiSink additionally wraps that text in OSC 8 hyperlink sequences. Like ColorMode, this is process-wide; tests that change it should restore the previous value in a finally.
public static CliHyperlinkMode HyperlinkMode { get; set; }

Property Value

CliHyperlinkMode

Logger

Optional logger used for render diagnostics.
public static ILogger? Logger { get; set; }

Property Value

ILogger

OutputEncoding

Output encoding assigned to OutputEncoding. Defaults to UTF-8.
public static Encoding OutputEncoding { get; set; }

Property Value

Encoding

TreatDbNullAsNull

Gets or sets whether Value is treated as null when setting cell content. Default is true.
public static bool TreatDbNullAsNull { get; set; }

Property Value

bool

Methods

AddOrUpdateCustomTheme(ITheme)

Registers a custom theme by its Name, replacing any existing custom theme with the same name (case-insensitive). Framework theme names and the reserved "default" alias cannot be registered.
public static void AddOrUpdateCustomTheme(ITheme theme)

Parameters

theme ITheme

Exceptions

ArgumentNullException
theme is null.
ArgumentException
The name is empty/whitespace, is "default", or is framework-owned.

CreateMarkupStyleResolver()

Builds a markup style resolver for the active theme and custom styles. Markup call sites use this so framework semantic tokens and app custom styles resolve consistently.
public static ThemeMarkupStyleResolver CreateMarkupStyleResolver()

Returns

ThemeMarkupStyleResolver

CreateMarkupStyleResolver(ITheme)

Builds a markup style resolver for an explicit theme while still honouring the active custom style registry.
public static ThemeMarkupStyleResolver CreateMarkupStyleResolver(ITheme theme)

Parameters

theme ITheme

Returns

ThemeMarkupStyleResolver

GetTheme(string)

Resolves a theme by name. "default" returns CurrentTheme; every other name is looked up in the shared framework+custom registry.
public static ITheme GetTheme(string name)

Parameters

name string

Returns

ITheme

Exceptions

ArgumentException
No theme is registered with the given name.

GetThemeNames()

Returns the names of all selectable themes — framework and registered custom themes. Does not include the "default" alias (which is not a stored theme). Snapshot; no internal state leaks.
public static IReadOnlyCollection<string> GetThemeNames()

Returns

IReadOnlyCollection<string>

Markup(IFormatProvider, string, params object[])

Formats text with Format(IFormatProvider, string, params object[]) and writes it as markup.
public static void Markup(IFormatProvider provider, string format, params object[] args)

Parameters

provider IFormatProvider
format string
args object[]

Markup(string)

Writes TigerCli bracket markup to stdout through the active output sink.
public static void Markup(string markup)

Parameters

markup string

MarkupError(IFormatProvider, string, params object[])

Formats text and writes it as markup to stderr.
public static void MarkupError(IFormatProvider provider, string format, params object[] args)

Parameters

provider IFormatProvider
format string
args object[]

MarkupError(string)

Writes TigerCli bracket markup to stderr through the active error sink.
public static void MarkupError(string markup)

Parameters

markup string

MarkupErrorLine(IFormatProvider, string, params object[])

Formats text and writes it as markup followed by a newline to stderr.
public static void MarkupErrorLine(IFormatProvider provider, string format, params object[] args)

Parameters

provider IFormatProvider
format string
args object[]

MarkupErrorLine(string)

Writes markup followed by a newline to stderr.
public static void MarkupErrorLine(string markup)

Parameters

markup string

MarkupLine()

Writes a blank line to stdout through the active output sink.
public static void MarkupLine()

MarkupLine(IFormatProvider, string, params object[])

Formats text and writes it as markup followed by a newline to stdout.
public static void MarkupLine(IFormatProvider provider, string format, params object[] args)

Parameters

provider IFormatProvider
format string
args object[]

MarkupLine(string)

Writes markup followed by a newline to stdout.
public static void MarkupLine(string markup)

Parameters

markup string

MarkupToAnsi(string, ITheme?)

Parses TigerCli bracket markup and returns it rendered as an ANSI SGR escape-sequence string (via AnsiSink), rather than writing to the console. Semantic tokens (e.g. [Accent]) are resolved through theme when supplied, otherwise through CurrentTheme. The base style is plain (no foreground/background), so the result contains escape sequences only for colours introduced by the markup. Primarily useful for tests, docs, and generated examples.
public static string MarkupToAnsi(string markup, ITheme? theme = null)

Parameters

markup string
theme ITheme

Returns

string

MarkupToHtml(string, HtmlSinkOptions?, ITheme?)

Parses TigerCli bracket markup and returns it rendered as a deterministic HTML string (via HtmlSink), rather than writing to the console. Semantic tokens (e.g. [Heading]) are resolved through theme when supplied, otherwise through CurrentTheme; the resolved CliCharStyle is rendered (the original token name is not reconstructed). The base style is plain, so only colours/decorations introduced by the markup appear. Primarily useful for tests, docs, and generated examples.
public static string MarkupToHtml(string markup, HtmlSinkOptions? options = null, ITheme? theme = null)

Parameters

markup string
options HtmlSinkOptions
theme ITheme

Returns

string

Render(CliRenderableComponent)

Converts a renderable component to a grid and renders it to stdout.
public static void Render(CliRenderableComponent component)

Parameters

component CliRenderableComponent

RenderGrid(CliGrid)

Renders a grid to stdout using the current TigerConsole sink policy.
public static void RenderGrid(CliGrid grid)

Parameters

grid CliGrid

RenderGrid(CliGrid, ICliRenderSink)

Measures the grid when needed and renders it through the supplied sink.
public static void RenderGrid(CliGrid grid, ICliRenderSink sink)

Parameters

grid CliGrid
sink ICliRenderSink

RenderGrid(TextWriter, CliGrid)

Renders a grid as plain text to a TextWriter.
public static void RenderGrid(TextWriter writer, CliGrid grid)

Parameters

writer TextWriter
grid CliGrid

RenderGrid(int, int, CliGrid)

Renders a grid at a terminal coordinate using a render buffer.
public static void RenderGrid(int x, int y, CliGrid grid)

Parameters

x int
y int
grid CliGrid

RenderGrid(int, int, CliRenderBuffer, CliGrid)

Reserved interactive render-buffer overload.
public static void RenderGrid(int x, int y, CliRenderBuffer buffer, CliGrid grid)

Parameters

x int
y int
buffer CliRenderBuffer
grid CliGrid

Exceptions

NotImplementedException
This overload is not implemented.

RenderGridToAnsi(CliGrid)

Renders a grid to an ANSI SGR string via AnsiSink. Layout is unbounded — set the grid's own SoftMaxWidth to emulate a terminal width.
public static string RenderGridToAnsi(CliGrid grid)

Parameters

grid CliGrid

Returns

string

RenderGridToHtml(CliGrid, HtmlSinkOptions?)

Renders a grid to deterministic HTML via HtmlSink.
public static string RenderGridToHtml(CliGrid grid, HtmlSinkOptions? options = null)

Parameters

grid CliGrid
options HtmlSinkOptions

Returns

string

RenderGridToLines(CliGrid)

Renders a grid to deterministic plain-text lines.
public static List<string> RenderGridToLines(CliGrid grid)

Parameters

grid CliGrid

Returns

List<string>

RenderToHtml(CliRenderableComponent, HtmlSinkOptions?)

Renders a component to a deterministic HTML string via HtmlSink — for snapshot tests and documentation examples. Opt-in; does not affect any console/ANSI/text output path.
public static string RenderToHtml(CliRenderableComponent component, HtmlSinkOptions? options = null)

Parameters

component CliRenderableComponent
options HtmlSinkOptions

Returns

string

RenderToLines(CliRenderableComponent)

Converts a renderable component to a grid and returns its rendered plain-text lines.
public static List<string> RenderToLines(CliRenderableComponent component)

Parameters

component CliRenderableComponent

Returns

List<string>

TryGetTheme(string?, out ITheme?)

Attempts to resolve a theme by name. Returns false (without throwing) for an unknown, null, empty, or whitespace name. "default" resolves to CurrentTheme.
public static bool TryGetTheme(string? name, out ITheme? theme)

Parameters

name string
theme ITheme

Returns

bool