Table of Contents

Namespace ItTiger.TigerCli.Terminal

Classes

AnsiSink
An ICliRenderSink that writes styled output as ANSI SGR escape sequences to a TextWriter. Unlike ItTiger.TigerCli.Terminal.ConsoleSink — which degrades ANSI 16–255 colours to the nearest ConsoleColorAnsiSink renders the full 0–255 palette faithfully (see ItTiger.TigerCli.Terminal.AnsiSgr for the mapping rules).

Style handling is deterministic and diffed: an escape sequence is emitted only when the foreground, background, or text decorations change; all changed attributes coalesce into a single sequence; and a null colour channel resolves to the ANSI default (39/49) rather than "leave as-is". Decoration flags emit attribute on/off codes (bold 1/22, italic 3/23, underline 4/24) diffed against the previous style. A reset (ItTiger.TigerCli.Terminal.AnsiSgr.Reset) — which also clears decorations — is emitted before each newline and on flush whenever a style is active, so a styled background never bleeds past the line.

This is TigerCli's terminal renderer, so it is terminal-bounded by default: it reports the terminal's width and height to the measure pass exactly as ItTiger.TigerCli.Terminal.ConsoleSink does, and structured output wraps in the layout rather than relying on the terminal's own auto-wrap. Pass Buffer when the writer is a string, file, or capture stream, so the render stays content-driven and identical on every machine.

ConsoleTerminal
Real console-backed terminal implementation.
ConsoleTerminalState
Snapshot of real console state captured by ConsoleTerminal so the terminal can restore colors after an interactive render.
HtmlSink
An ICliRenderSink that renders TigerCli text segments to deterministic HTML — for snapshot tests (internal and external) and for generating documentation examples from real rendering. It is not a browser UI framework: output is plain <pre class="tigercli"> + <span> (and optionally <a>) markup.

This sink renders the CliCharStyle it receives; it does not reconstruct the original semantic token (e.g. [Heading]) once it has been resolved to a concrete style. Text decorations and the link role map to stable CSS classes (tc-bold, tc-italic, tc-underline, tc-link); foreground/background colours map to a deterministic inline #RRGGBB hex derived from CliColorPalette (the 256-colour palette has no stable CSS class names). Text content is HTML-escaped, attribute values are attribute-escaped, and whitespace/line breaks are preserved via the <pre> wrapper. No ANSI is ever emitted.

Like the ANSI sink, link text is always written visibly and copyably. In Anchor a non-empty, safe HyperlinkTarget is additionally wrapped in <a href="…">; an empty or unsafe target (control characters, or a javascript:/vbscript:/data: scheme) falls back to a styled span.

HtmlSinkOptions
Options for HtmlSink. Defaults are conservative and documentation-friendly: output is wrapped in <pre class="tigercli">, links render as visible text (no anchors), and layout is unbounded (no emulated terminal width).
TerminalCapabilities
Detects the ANSI capability of a console stream for Auto. The decision is conservative about whether ANSI is allowed at all (redirected streams, NO_COLOR, CLICOLOR=0, and TERM=dumb/empty all disable it) but practical once it is: a normal interactive non-Windows terminal resolves to Ansi256 without requiring TERM to advertise 256color. The pure Detect(Func<string, string?>, bool, bool, bool) core takes all environment inputs as parameters so it can be unit-tested without touching the real process environment.
TigerConsole
Static entry point for TigerCli console output, markup rendering, structured rendering, themes, colour mode, and test/documentation capture helpers.

Interfaces

ICliRenderSink
Sink abstraction used by the render pipeline to write styled text segments.
ICliTerminal
Terminal abstraction used by interactive rendering and test hosts.
ITerminalState
Snapshot marker interface for terminal state captured before an interactive render.