Spectre.Console concepts and their ConsoleMonster counterparts, with the markup dialect the two share and where it differs.
Spectre.Console is a widely used .NET library for rich console output, and its markup syntax is familiar to many .NET developers. ConsoleMonster is a separate library with its own parser and renderer. Its markup follows the same dialect, so a reader who knows one can read the other. This page maps the concepts from one to the other and notes where they behave differently.
markup.ps1PowerShell 7.6
Markup in the Spectre.Console dialect: cadetblue, grey50, deepskyblue3#ff8800, rgb(120,200,90), color(208) and theme roles
[brackets] are literal, unknown tags keep their text, and links use OSC 8
PowerShellmarkup.ps1
Write-ConsoleMarkup '[bold red]Markup[/] in the [italic]Spectre.Console[/] dialect: [cadetblue]cadetblue[/], [grey50]grey50[/], [deepskyblue3]deepskyblue3[/]'
Write-ConsoleMarkup '[#ff8800]#ff8800[/], [rgb(120,200,90)]rgb(120,200,90)[/], [color(208)]color(208)[/] and [white on fail] theme roles [/]'
Write-ConsoleMarkup '[[brackets]] are literal, [nosuchcolour]unknown tags[/] keep their text, and [link=https://consolemonster.dev]links[/] use OSC 8'
Write-ConsoleMarkup in PowerShell 7: palette names, hex and rgb() colours, theme roles as backgrounds, escaped brackets, an unknown tag and a link.
Names are the 256 xterm names. A name that appears twice in the xterm list takes _1, _2, as in [blue3_1]. Colours are reduced to what the console can show.
[link=https://example.com]text[/], [link]…[/]
the same
OSC 8 hyperlinks in terminals that support them, plain text elsewhere. Only absolute http, https, mailto and ftp targets link.
:emoji: shortcodes
not supported
Write the emoji character itself; it is measured as two cells.
An unknown style is an error
removed, its text kept
An unknown tag that is never closed stays literal, since it is most likely text such as [x]. Markup.Strict = true throws a FormatException instead, and Markup.Validate reports the first problem without throwing.
—
theme roles: [pass], [fail], [warn], [muted], [accent] and others
Roles follow the active theme and also work as backgrounds ([white on fail]).
In markup, a colour name is the 256-colour palette name, so [darkred] is palette colour 52 and [grey] palette colour 8. ConsoleMonster's PowerShell cmdlets also take -Color and -BackgroundColor parameters, where a name keeps its Write-Host meaning. Either meaning can be asked for in either place: console.<name> is the ConsoleColor as Write-Host shows it ([console.darkred] in markup), and palette.<name> is the palette colour (-Color palette.darkred).
Terminal.WriteMarkupLine(Markup.Interpolate($"[pass]{server}[/] answered in [muted]{elapsed:N1}s[/]"));
Widgets
Spectre.Console
ConsoleMonster
Notes
Table
Table
Columns carry a priority, a minimum and maximum width and an overflow rule. Tables fit the console width, and below a set width rows become cards; see tables.
Tree
Tree
Panel
Panel
Rule
Rule
BarChart / BreakdownChart
BarChart / StackedBar
ConsoleMonster also has Sparkline, Histogram and LineChart.
Columns, Rows, Grid, Padder, Align
Columns, Rows, Grid, Stack, Align
Layout
Dashboard and DashboardBuilder
Named panels in a header, body and footer, sized to the window.
Progress columns are a column model; see live sessions.
AnsiConsole.Live(renderable).Start(ctx => ...)
LiveSession
Updates are events addressed to widgets by name and can come from any thread.
AnsiConsole.Record() / ExportHtml()
ConsoleExporter.ToHtml(...), LiveRecorder
Exports a frame, or records a session's events for replay and export.
Terminal.Status("Resolving…", ctx => {
foreach (string dc in controllers) {
ctx.Update(Markup.Interpolate($"Querying [accent]{dc}[/]"));
Query(dc);
}
});
Terminal.Status draws a one-line spinner as an inline live area. Console output written meanwhile scrolls above it, and the line is removed when the work ends, also when it throws. Redirected output, CI logs and plain mode get each new status text once, as a plain line.
Prompts
Spectre.Console
ConsoleMonster
TextPrompt<T>
TextPrompt, NumberPrompt, PathPrompt
SelectionPrompt<T>
SelectPrompt<T>
MultiSelectionPrompt<T>
MultiSelectPrompt<T>
ConfirmationPrompt
ConfirmPrompt, TypedConfirmPrompt
ConsoleMonster also has forms, menus and a grid; the interactive page shows them.
Outside this mapping
Spectre.Console.Cli parses command lines and maps them to commands. ConsoleMonster has no command-line parser and can be used next to one.
Testing. Spectre.Console.Testing provides a TestConsole. ConsoleMonster renders to a fixed profile in memory: TerminalProfile.Fixed with ConsoleExporter.ToText, and ScreenCapture with scripted keys for prompts.