Quick start
Once the library is installed, every program follows the same shape:
uses VSoft.AnsiConsole;- Call class methods on the static
AnsiConsolefacade for I/O. - Build widgets with the
Widgetsfactory record and pass them toAnsiConsole.Write.
Hello world
program Hello;
{$APPTYPE CONSOLE}
uses
VSoft.AnsiConsole;
begin
AnsiConsole.MarkupLine('[bold yellow]Hello[/] [italic]world[/]!');
AnsiConsole.MarkupLine('Numbers: [red]1[/], [green]2[/], [blue]3[/] :rocket:');
end.Two things to notice:
- Markup tags like
[bold yellow]and[italic]style the surrounding text. Closing tag is[/]. See the markup syntax reference for the full grammar. - Emoji shortcodes like
:rocket:resolve to the corresponding unicode glyph. See the emoji reference.
Run it. You'll see styled coloured output if your terminal supports ANSI - which it does on every modern Windows Terminal, VS Code integrated terminal, PowerShell 7+, ConEmu, and pretty much anything not running cmd.exe from Windows 7.
TIP
The first call to any AnsiConsole.X method lazily constructs a singleton IAnsiConsole with capabilities auto-detected from the host terminal. No explicit setup needed.
Building a widget
Widgets are values you build with the Widgets factory record and write with AnsiConsole.Write.
program Greeting;
{$APPTYPE CONSOLE}
uses
VSoft.AnsiConsole;
var
panel : IPanel;
begin
panel := Widgets.Panel(Widgets.Markup('[bold]hello[/] world'))
.WithHeader('Greeting')
.WithBorder(TBoxBorderKind.Rounded);
AnsiConsole.Write(panel);
end.That renders:
╭── Greeting ───────╮
│ hello world │
╰───────────────────╯Markup vs Write
Two methods for emitting text. Pick by intent:
AnsiConsole.MarkupLine('[bold]hi[/]')— parses BBCode-style tags. Use this for styled output.AnsiConsole.WriteLine('[bold]hi[/]')— literal, no parsing. The brackets appear verbatim.
The widget form is Widgets.Markup('[bold]hi[/]'), which returns an IMarkup you can embed in panels, table cells, etc.
What's next
- Architecture — how segments, renderables, and the ANSI writer fit together.
- Markup widget — full BBCode grammar.
- Panel, Table, Tree — the headline widgets.
- Status and Progress — live displays for long-running work.
- Prompts —
Ask,Confirm,SelectionPrompt<T>.
Or browse the runnable demo snippets at demos/snippets/ - every widget has one.