XenoAtom.Ansi
1.5.0
Prefix Reserved
dotnet add package XenoAtom.Ansi --version 1.5.0
NuGet\Install-Package XenoAtom.Ansi -Version 1.5.0
<PackageReference Include="XenoAtom.Ansi" Version="1.5.0" />
<PackageVersion Include="XenoAtom.Ansi" Version="1.5.0" />
<PackageReference Include="XenoAtom.Ansi" />
paket add XenoAtom.Ansi --version 1.5.0
#r "nuget: XenoAtom.Ansi, 1.5.0"
#:package XenoAtom.Ansi@1.5.0
#addin nuget:?package=XenoAtom.Ansi&version=1.5.0
#tool nuget:?package=XenoAtom.Ansi&version=1.5.0
XenoAtom.Ansi

<img align="right" width="256px" height="256px" src="https://raw.githubusercontent.com/XenoAtom/XenoAtom.Ansi/main/img/XenoAtom.Ansi.png">
XenoAtom.Ansi is a fast, allocation-friendly .NET library for building rich ANSI/VT output and processing ANSI text. It helps you emit styled sequences, format markup, tokenize streams, and perform ANSI-aware text operations.
โจ Features
net10.0+ library and NativeAOT ready- Fast, allocation-friendly APIs
- Rendering / Emitting
AnsiWriterfluent API (writes toTextWriterorIBufferWriter<char>)AnsiMarkupfor markup strings, including interpolated strings (formatted values are escaped)- SGR styling: colors (basic-16, 256-color, truecolor RGB), decorations (bold/dim/italic/underline/etc), reset
- Capability-aware output (
AnsiCapabilities) including color downgrading and optional safe-mode behavior - Cursor/screen helpers (ANSI/DEC/xterm/Windows Terminal): move/position, save/restore, erase (incl. scrollback), insert/delete chars/lines, scrolling + scroll regions, cursor style, mode toggles, tabs, alternate screen, soft reset
- OSC helpers with configurable terminator (BEL or ST): window title (OSC 0/2), palette edits (OSC 4), hyperlinks (OSC 8)
- Parsing
- Streaming ANSI/VT tokenizer (
AnsiTokenizer) with chunked parsing support (ESC and 8-bit C1 forms) - Token model for Text, selected controls, ESC, CSI, OSC, decoded SGR, and malformed/unknown sequences (tolerant; never throws)
- Input interpretation helpers for keys, mouse (SGR), and cursor position reports (CPR)
- Styled runs parser (
AnsiStyledTextParser) that interprets SGR + OSC 8 intoAnsiStyle/hyperlink runs
- Streaming ANSI/VT tokenizer (
- Text Utilities
- ANSI-aware text helpers (
AnsiText): strip, visible width measurement (wcwidth), wrap, truncate (optionally preserving ANSI)
- ANSI-aware text helpers (
- Color Helpers
- Palettes (
AnsiColors,AnsiColors.Web,AnsiPalettes) for named colors and xterm-like RGB approximations
- Palettes (
XenoAtom.Ansi is a low-level foundation library, not a terminal UI framework like Spectre.Console.
It focuses on emitting and parsing ANSI/VT sequences against TextWriter / character buffers.
It does not provide widgets, layout, input loops, or terminal state management (those belong in higher-level libraries).
๐งช Samples

samples/HelloWorldโ basic formatting across a few linessamples/HelloAdvancedโ richer demo (colors, decorations, markup, OSC 8 links, screen helpers)
Run:
dotnet run --project samples/HelloWorld/HelloWorld.csprojdotnet run --project samples/HelloAdvanced/HelloAdvanced.csproj
๐ User Guide
For more details on how to use XenoAtom.Ansi, please visit the user guide.
๐ชช License
This software is released under the BSD-2-Clause license.
๐ค Author
Alexandre Mutel aka xoofx.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Wcwidth (>= 4.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on XenoAtom.Ansi:
| Package | Downloads |
|---|---|
|
XenoAtom.Terminal
A modern, cross-platform replacement for System.Console: unified input events (keys/mouse/resize), rich ANSI/markup output (XenoAtom.Ansi), thread-safe atomic writes, CI-friendly colors, and an in-memory backend for deterministic tests. |
GitHub repositories
This package is not used by any popular GitHub repositories.