termancy Guide Components Commands API

term

term - the terminal underneath cli and tui: what it can show, how wide text is, escape sequences both ways, styled text and its layout, and the terminal device itself. Everything here writes to a *std.Io.Writer or reads bytes; nothing runs an event loop (that is tui.Program).

name
capabilitydetect(environ, .{ .is_tty }): color level and whether escapes are allowed; ci
widthdisplay width (of), truncate, wrap, Wrapper, cluster Iterator
ansiescape sequences as functions; strip, downsample; Color
Style, Colorcolors and attributes; padding, margin, border, width, alignment
layoutjoinHorizontal, joinVertical, place, size, split
inputKey (parse, matches, printable), Mouse, Event, Decoder, encode
Parserthe VT500 state machine: text and every kind of escape sequence, as actions
Penthe attributes SGR sets, applied from parameters and written as the shortest change
vtScreen: a virtual terminal that runs what a real one runs, for tests and capture
explainescape sequences in words (describe), and output split into text and sequences
Ptya program on a pseudo-terminal (ConPTY on Windows): its output, input, size
Buffera grid of cells: styled text laid out, blocks drawn over it, rows written out
Rendererframes to a terminal, writing only the cells that changed
Canvas, Layerblocks at positions, stacked by depth: dialogs, toasts, popups
Tablea table drawn as text: header, rows, borders, cell styles, a width to fit
List, Treelists (bullets, numbers, letters, roman) and trees drawn as text
highlightsyntax highlighting: 30 languages, themes (charm, dracula, monokai, ...)
TrueTypeTrueType fonts: glyphs by codepoint, metrics, anti-aliased masks
imageRGBA images; PNG and GIF written and read; JPEG read (baseline, progressive)
graphicsimages in the terminal: kitty, iTerm2, sixel, or half-block mosaic
goldenoutput checked against golden files, rewritten on TERMANCY_UPDATE_GOLDEN=1
diffline diffs (Myers): unified writes diff -u output, colored or plain
rastera screen drawn as pixels in a font, and the window around it
fontsthe machine's fonts, found by family name, loaded with fallbacks
Regexregular expressions for waiting on screens and matching lines
markdownMarkdown rendered for the terminal, as glamour: style sheets, highlighting
livespinners, progress bars, step lists: redrawn in place, or a line per change
Terminal, Sizeraw mode, size, the controlling terminal, restore on panic
const term = @import("term");

const cap = term.capability.detect(environ, .{ .is_tty = true });
const title: term.Style = .{ .fg = .hex(0xff8700), .bold = true };
try title.renderFor(w, cap.color, "Hello");

The module imports only std. It builds for WASI too, where Terminal finds no terminal.

The full API reference