Namespace Retro.Crt
Classes
- Banner
Pascal-style banners. Two flavours: a framed
Boxfor titles, and a per-line Gradient(string[], Color, Color, bool) for fancier startup screens.
- Crt
Pascal CRT-Unit-style console. Static, stateless from the caller's view — just the verbs, plus a small WithStyle(Color?, Color?, bool) scope for transient styling.
- Diagnostics
Helpers for inspecting and logging Retro.Crt's runtime capability detection.
- Log
Tiny semantic logger — not an
ILoggerreplacement. PrintsHH:MM:SS LEVEL messagewith a colored level tag. Warn/Error go to Error; everything else to Out, unless redirected via OutSink / ErrSink.
- ProgressBar
Single-line progress bar that redraws in place via carriage return. Use once via
using var bar = ProgressBar.Start(total);— disposing finishes the bar (full fill + newline).
- Prompt
Tiny interactive prompts: yes/no
Confirm, free-textAsk, arrow-keySelect. All zero-dependency, AOT-clean. Without ANSI,Selectdegrades to a numbered list with ReadLine().
- ScreenBuffer
A double-buffer-friendly cell grid: a fixed-size 2D array of Cell with helpers for clearing, writing strings, and filling rectangles. Pair with Render(ScreenBuffer?, ScreenBuffer, TextWriter) to flush a frame to a terminal as minimal ANSI.
- ScreenRenderer
Diff renderer: emits the minimal stream of ANSI sequences that turns a previous frame into a current frame on the terminal. Pair with ScreenBuffer to drive flicker-free game loops or TUI redraws.
- Spinner
Single-line animated spinner. Use once via
using var s = Spinner.Show("loading…");— disposing stops the animation, clears the spinner line, and emits a newline.
- Table
Tiny aligned-column table renderer. Box-drawing borders by default, header in bold, optional foreground colors for header and borders. One column auto-resizes to its widest cell — no manual width configuration. Single-line cells only.
- Themes
Built-in Retro.Crt themes. Each is a snapshot of the most recognizable color combination from its era — close enough to be instantly familiar without trying to be a museum-grade emulation. All presets are designed to read well on the user's existing terminal background (typically dark); themes do not own a bg slot.
- Typewriter
Reveals text one character at a time. Optional fake cursor between characters and optional Alpha fade-in (brightness ramp on the final glyph). The trailing cursor, if any, is always erased before Type(string, int, Color?, TypewriterCursor, TypewriterFade, (Color from, Color to)?) returns.
Assumes one terminal cell per char: surrogate pairs (emoji), combining marks, and wide CJK glyphs break the cursor-overwrite tracking used by cursor mode and alpha fade. Stick to BMP single-cell characters for animated reveals.
Structs
- Cell
One cell of a ScreenBuffer: a single glyph plus the foreground / background / attributes the diff renderer should paint it with. Value-equality so cell-by-cell diffing is a straight
==.
- Color
A console color in 24-bit truecolor, an xterm 256-palette index, or one of the 16 standard SGR slots. Use Rgb(byte, byte, byte) for arbitrary colors, Indexed256(byte) for xterm palette entries, and the named static fields (LightCyan, Brown, …) for the classic DOS palette mapped onto the user's terminal theme.
- TerminalReport
Snapshot of the capability flags Retro.Crt detected on this process. Useful for "why don't I see colors" support questions — log this once at startup and the answer is usually obvious.
- Theme
A curated palette evoking a specific era of computing: DOS, an amber CRT, a modern dark IDE, etc. Themes are pure data — pick the colors you want and pass them to Banner, ProgressBar, WithStyle(Color?, Color?, bool), or anywhere else a Color is accepted.
Enums
- BoxAlign
Horizontal alignment of content lines inside a
Banner.Box. Affects the spaces injected around each line; the frame and padding stay the same.
- CellAttrs
Visual attributes a Cell can carry alongside its foreground / background colors. Maps to a small subset of SGR attributes that matter for retro UI work — bold for emphasis, underline for hyperlinks / focused fields. Italic / strikethrough can be added later if a real consumer needs them.
- ColorDepth
What the terminal can actually render. Detected once at startup; every emitted color is quantized down to the highest depth this terminal understands so an
ESC[38;2;R;G;Bnever reaches a 16-color VT520.
- LogLevel
Severity levels recognised by Log. The integer values are stable but not part of the public contract — compare by name.
- SpinnerStyle
Animation style for Spinner. Pick the frame set that matches your aesthetic — Pipe is the classic ASCII rotator and works on every terminal; the unicode variants ( Braille, Block, Arc) silently fall back to Pipe on terminals without unicode output.
- TableBorder
Border style for Print(string[]?, string[][], TableBorder, Color?, Color?).
- TypewriterCursor
Whether — and how — a fake cursor should follow each character as the Typewriter writes it.
- TypewriterFade
How each character "appears" before settling into its final form.