Retro.Crt
Tiny, zero-dep, AOT-clean Pascal-CRT charm for .NET CLIs.
Pascal CRT-Unit verbs (TextColor, GotoXY, ClrScr, ClrEol,
Bell), truecolor with graceful 256-color, 16-color, and NO_COLOR
fallback, nine built-in themes (six era-faithful retro presets and
three modern dark themes), and a small set of curated output blocks —
framed banners, in-place progress bars, animated spinners, aligned
tables, interactive prompts, a five-level logger, and a typewriter
that fades characters in. Plus alt-screen takeover for vim/less-style
apps.
dotnet add package Retro.Crt
using Retro.Crt;
Crt.TextColor(Color.LightCyan);
Crt.WriteLine("system online.");
using (Crt.WithStyle(Color.Yellow, bold: true))
Crt.WriteLine("> ready.");
Targets net10.0. No third-party dependencies.
Why
Spectre.Console is great, but it does not trim or AOT cleanly. For a small CLI that publishes trim- or AOT-safe — a launcher, a build tool, a one-shot installer — pulling Spectre in noticeably bloats the output and breaks the trim pass. Retro.Crt is the small, opinionated alternative for tools that want curated colored output, themed widgets, and nothing more elaborate than a table.
Comparison
| Retro.Crt | Spectre.Console | Pastel | Crayon | |
|---|---|---|---|---|
| Trim / AOT clean | ✅ | ❌ | ✅ | ✅ |
| Runtime dependencies | 0 | many | 0 | 0 |
| Truecolor | ✅ | ✅ | ✅ | ❌ |
| 256-color quantization | ✅ | ✅ | ❌ | ❌ |
| Pascal-flavoured verbs | ✅ | ❌ | ❌ | ❌ |
| Framed banner | ✅ | ✅ | ❌ | ❌ |
| Progress bar | ✅ (single) | ✅ (multi/live) | ❌ | ❌ |
| Spinner | ✅ | ✅ | ❌ | ❌ |
| Aligned tables | ✅ (basic) | ✅ (rich) | ❌ | ❌ |
| Interactive prompts | ✅ (3 verbs) | ✅ (rich) | ❌ | ❌ |
| Themes | ✅ (9 presets) | ✅ | ❌ | ❌ |
| Trees / forms / panels | ❌ | ✅ | ❌ | ❌ |
| Live regions / layout | ❌ | ✅ | ❌ | ❌ |
| Markup language | ❌ | ✅ | ❌ | ❌ |
| Alt-screen takeover | ✅ | ❌ | ❌ | ❌ |
| Built-in logger | ✅ (tiny) | ❌ | ❌ | ❌ |
If you need trees, forms, panels, live layouts, or a markup language — use Spectre.Console. If your CLI publishes trim- or AOT-safe and you don't want a single console UI library to be the thing that breaks that — and you'd settle for a charming splash screen, themed output, a few log levels, a progress bar, a spinner, simple tables, and three flavours of prompt — this library.
Demos
Three tiers under the repo on GitHub — clone and run any of them:
# samples/ — small single-feature tours
dotnet run --project samples/Retro.Crt.Demo # 25 s feature tour
dotnet run --project samples/Retro.Crt.Themes.Demo # all 9 themes side by side
dotnet run --project samples/Retro.Crt.Matrix.Demo # "Wake up, Neo" cinematic
dotnet run --project samples/Retro.Crt.Boot.Demo # fake AMIBIOS POST + DOS prompt
dotnet run --project samples/Retro.Crt.Capabilities.Demo # color-depth fallback
dotnet run --project samples/Retro.Crt.AltScreen.Demo # alt-screen takeover, restores your shell
dotnet run --project samples/Retro.Crt.ScreenBuffer.Demo # cell-grid + diff renderer
dotnet run --project samples/Retro.Crt.Input.Demo # live input event probe
dotnet run --project samples/Retro.Crt.Tui.Demo # Tui widget tour
# games/ — five ASCII games on the core's ScreenBuffer + RawMode
dotnet run --project games/snake -c Release
dotnet run --project games/life -c Release
dotnet run --project games/matrix-rain -c Release
dotnet run --project games/invaders -c Release
dotnet run --project games/tetris -c Release
# apps/ — substantial tech demos
dotnet run --project apps/commander -c Release # Norton-Commander-Lite
Public surface at a glance
Core
Crt— Pascal verbs (TextColor,GotoXY,ClrScr,ClrEol,Bell,PaintBackground),WithStyle/UseTheme/WithSink/UseAlternateScreenscopes, capability accessors (ColorEnabled,Depth,IsInteractive,WindowWidth,CursorLeft,Sink).Color— DOS palette, truecolor, xterm-256 viaColor.Indexed256, depth-aware quantization throughColor.For, hex / name parsing.ColorMode—Truecolor/Standard16/Xterm256.ColorDepth— what the terminal can render:None/Standard16/Xterm256/Truecolor.
Output blocks
Banner— framedBox(withBoxAlign) and per-lineGradient.ProgressBar— single-line redraw, cursor-anchored,Crt.FillWidthfor terminal-width sizing.Spinner— animated single-line spinner; pick a frame set viaSpinnerStyle.Table— aligned-column tables withTableBorderbox / borderless modes.Typewriter— character-by-character reveal with optional cursor (TypewriterCursor) and fade (TypewriterFade).Blinkfor pause beats, async + cancellation supported.Prompt—Confirm,Ask, arrow-keySelect.Log— semantic logger withLogLeveltags,MinLevelfilter,OutSink/ErrSinkoverrides, scopedUseSink.
Theming
Theme— record struct with six slots (Foreground, Accent, Muted, Success, Warn, Error). Themes do not own a background — set one explicitly per call when you need it.Themes— built-in palettes: retro (Dos,AmberCrt,GreenCrt) and modern dark (Midnight,Slate,Twilight).- Apply with
Crt.UseTheme(Themes.AmberCrt)— widgets fall back to the theme's slots when no explicit color is passed.
Diagnostics
Diagnostics—Capture()returns aTerminalReportwithColorDepth,IsInteractive, encoding, env vars;ToString()gives a one-line dense summary for support tickets.
Cell grid + input (Stage 3 + 2a/2b)
ScreenBuffer+ScreenRenderer— stateful cell grid (Cellper coordinate, eachGlyph+Fg+Bg+CellAttrs) plus a minimal-ANSI diff renderer that emits cursor moves + SGR + chars only for cells that actually changed. Pair withCrt.UseAlternateScreen()for flicker-free game loops.Retro.Crt.Input—KeyEventwithKeyModifiers,MouseEvent,InputEventtagged union; statelessInputParserfor ANSI/CSI/SS3 decode;RawMode.Enter()for per-OS termios +SetConsoleMode;TerminalInput.ReadEvent/TryReadEvent/WaitForEventfor the actual stdin pump.Crt.UseMouse()/Crt.UseBracketedPaste()/Crt.UseHiddenCursor()— IDisposable scopes for SGR mouse mode, paste envelopes, and cursor hiding.
Retro.Crt.Tui
Separate package on top of the core's ScreenBuffer + diff renderer +
input parser, for full-screen DOS-style UIs (Midnight Commander /
Turbo Vision style). Application runs the alt-screen + raw + mouse +
diff-redraw event loop; View and Container are the bases; widgets
include Panel, Label, Button, LogViewer, TextBox, Menu,
Dialog (with Dialog.MessageBox helper), StackPanel, plus an
abstract ScrollViewer. Layout.Split / Layout.Dock are span-based
zero-alloc geometry helpers.
dotnet add package Retro.Crt.Tui
Browse the full namespace in the API reference.
More
- Full README on GitHub — narrative how-to-use guide with code samples for every feature.
- Roadmap — what's shipped, planned, and parked.
- Changelog — release-by-release diff.
- Benchmarks — BenchmarkDotNet baseline numbers.
- Contributing — how to file issues, propose features, and submit PRs.
- Retro.Crt on NuGet and
Retro.Crt.Tui on NuGet —
released on tag pushes via
.github/workflows/release.yml(v*tags ship core,tui-v*tags ship the widget layer).
License
MIT.