Class TigerConsole
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
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
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
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
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
Logger
Optional logger used for render diagnostics.
public static ILogger? Logger { get; set; }
Property Value
OutputEncoding
Output encoding assigned to OutputEncoding. Defaults to UTF-8.
public static Encoding OutputEncoding { get; set; }
Property Value
TreatDbNullAsNull
public static bool TreatDbNullAsNull { get; set; }
Property Value
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
themeITheme
Exceptions
- ArgumentNullException
themeisnull.- 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
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
themeITheme
Returns
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
namestring
Returns
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
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
providerIFormatProviderformatstringargsobject[]
Markup(string)
Writes TigerCli bracket markup to stdout through the active output sink.
public static void Markup(string markup)
Parameters
markupstring
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
providerIFormatProviderformatstringargsobject[]
MarkupError(string)
Writes TigerCli bracket markup to stderr through the active error sink.
public static void MarkupError(string markup)
Parameters
markupstring
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
providerIFormatProviderformatstringargsobject[]
MarkupErrorLine(string)
Writes markup followed by a newline to stderr.
public static void MarkupErrorLine(string markup)
Parameters
markupstring
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
providerIFormatProviderformatstringargsobject[]
MarkupLine(string)
Writes markup followed by a newline to stdout.
public static void MarkupLine(string markup)
Parameters
markupstring
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
Returns
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
markupstringoptionsHtmlSinkOptionsthemeITheme
Returns
Render(CliRenderableComponent)
Converts a renderable component to a grid and renders it to stdout.
public static void Render(CliRenderableComponent component)
Parameters
componentCliRenderableComponent
RenderGrid(CliGrid)
Renders a grid to stdout using the current TigerConsole sink policy.
public static void RenderGrid(CliGrid grid)
Parameters
gridCliGrid
RenderGrid(CliGrid, ICliRenderSink)
Measures the grid when needed and renders it through the supplied sink.
public static void RenderGrid(CliGrid grid, ICliRenderSink sink)
Parameters
gridCliGridsinkICliRenderSink
RenderGrid(TextWriter, CliGrid)
Renders a grid as plain text to a TextWriter.
public static void RenderGrid(TextWriter writer, CliGrid grid)
Parameters
writerTextWritergridCliGrid
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
RenderGrid(int, int, CliRenderBuffer, CliGrid)
Reserved interactive render-buffer overload.
public static void RenderGrid(int x, int y, CliRenderBuffer buffer, CliGrid grid)
Parameters
xintyintbufferCliRenderBuffergridCliGrid
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
gridCliGrid
Returns
RenderGridToHtml(CliGrid, HtmlSinkOptions?)
Renders a grid to deterministic HTML via HtmlSink.
public static string RenderGridToHtml(CliGrid grid, HtmlSinkOptions? options = null)
Parameters
gridCliGridoptionsHtmlSinkOptions
Returns
RenderGridToLines(CliGrid)
Renders a grid to deterministic plain-text lines.
public static List<string> RenderGridToLines(CliGrid grid)
Parameters
gridCliGrid
Returns
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
componentCliRenderableComponentoptionsHtmlSinkOptions
Returns
RenderToLines(CliRenderableComponent)
Converts a renderable component to a grid and returns its rendered plain-text lines.
public static List<string> RenderToLines(CliRenderableComponent component)
Parameters
componentCliRenderableComponent
Returns
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)