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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XenoAtom.Ansi" Version="1.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XenoAtom.Ansi" Version="1.5.0" />
                    
Directory.Packages.props
<PackageReference Include="XenoAtom.Ansi" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XenoAtom.Ansi --version 1.5.0
                    
#r "nuget: XenoAtom.Ansi, 1.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XenoAtom.Ansi@1.5.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XenoAtom.Ansi&version=1.5.0
                    
Install as a Cake Addin
#tool nuget:?package=XenoAtom.Ansi&version=1.5.0
                    
Install as a Cake Tool

XenoAtom.Ansi ci coverage NuGet

<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
    • AnsiWriter fluent API (writes to TextWriter or IBufferWriter<char>)
    • AnsiMarkup for 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 into AnsiStyle/hyperlink runs
  • Text Utilities
    • ANSI-aware text helpers (AnsiText): strip, visible width measurement (wcwidth), wrap, truncate (optionally preserving ANSI)
  • Color Helpers
    • Palettes (AnsiColors, AnsiColors.Web, AnsiPalettes) for named colors and xterm-like RGB approximations

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

Example of XenoAtom.Ansi output

  • samples/HelloWorld โ€” basic formatting across a few lines
  • samples/HelloAdvanced โ€” richer demo (colors, decorations, markup, OSC 8 links, screen helpers)

Run:

  • dotnet run --project samples/HelloWorld/HelloWorld.csproj
  • dotnet 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
1.5.0 402 1/24/2026
1.4.0 96 1/19/2026
1.3.0 165 1/9/2026
1.2.1 96 1/4/2026
1.2.0 174 1/2/2026
1.1.0 92 12/31/2025
1.0.0 91 12/30/2025