libghostty-vt-dotnet

April 19, 2026 · View on GitHub

.NET bindings for libghostty-vt — the standalone virtual terminal parser from the Ghostty terminal emulator.

Use this library to parse VT output, inspect the terminal grid, build your own renderer, or embed a terminal in any .NET application without pulling in the full Ghostty GUI.

What's included

NamespaceDescription
Ghostty.Vt.TerminalCreate terminals, write VT sequences, read state
Ghostty.Vt.RenderStateInspect the screen grid, rows, cells, colors, cursor
Ghostty.Vt.KeyEncoderEncode keyboard events into VT escape sequences
Ghostty.Vt.MouseEncoderEncode mouse events into VT sequences
Ghostty.Vt.OscParserParse OSC (Operating System Command) sequences
Ghostty.Vt.SgrParserParse SGR (Select Graphic Rendition) attributes
Ghostty.Vt.FormatterFormat grid content as plain text, HTML, or VT
Ghostty.Vt.KittyGraphicsQuery Kitty image protocol placements
Ghostty.Vt.GridRefReference and compare grid positions
Ghostty.Vt.FocusFocus reporting
Ghostty.Vt.PasteBracketed paste encoding

Prerequisites

Quick start

# Build the native library (clones ghostty upstream, compiles libghostty-vt)
just build-native

# Restore, build, test
just ci

Or step by step:

just build-native   # clone + compile libghostty-vt
just restore        # dotnet restore
just build          # dotnet build
just test           # dotnet test

Usage example

using Ghostty.Vt;

// Create a 80x24 terminal
using var terminal = new Terminal(80, 24);

// Write VT sequences
terminal.VTWrite("\x1b[31mHello, \x1b[1mWorld!\x1b[0m");

// Inspect the grid
using var renderState = new RenderState();
terminal.UpdateRenderState(renderState);

foreach (var row in renderState.Rows)
{
    // Read cell content, style, colors
}

NuGet

The library ships as DeBlasis.GhosttyVt on NuGet with native runtimes for:

PlatformRuntime IDNative library
Windows x64win-x64ghostty-vt.dll
Linux x64linux-x64libghostty-vt.so
macOS ARM64osx-arm64libghostty-vt.dylib

Development

# Full CI pipeline
just ci

# Build native for a specific target
just build-native target=x86_64-linux

# Pack a NuGet package
just pack version=1.0.0

# Check for upstream Ghostty changes
just check-upstream

CI

GitHub Actions builds the native library from upstream ghostty-org/ghostty and runs all tests on every push. A daily workflow checks for upstream changes and publishes prerelease packages automatically. Stable releases are cut via annotated v* tags — see RELEASING.md.

License

MIT