← All libraries

SugarSpark

🔍 SugarSpark

ANSI escape-sequence inspector

port of sequin ansi debugging inspector

Pipe styled output through SugarSpark and each escape becomes a labelled line. Decodes SGR / CSI / OSC / DCS / APC / SS3, DEC private modes, kitty keyboard protocol, synchronized output, unicode grapheme mode.

Install

composer require candycore/sugar-spark

Quickstart

$ printf '\e[31mhello\e[0m world\n' | sugarspark
ESC[31m  SGR foreground red
hello
ESC[0m   SGR reset
 world

$ printf '\e]0;new title\e\\' | sugarspark
ESC]0;new title  set window title to "new title"

$ printf '\e[?2026h' | sugarspark
ESC[?2026h  enable synchronized output

What's in the box

SGRForeground / background (16 / 256 / 24-bit truecolor) + bold / italic / underline / blink / reverse / strike / faint.
CSICursor moves, erase, scroll region (DECSTBM), insert/delete line/char, DECSCUSR cursor shape, DECRQM/DECRPM mode query.
OSCTitle (0/2), icon (1), palette (4), cwd (7), hyperlink (8).
DEC privateCursor visibility, mouse modes (1000/1002/1003/1006/1015), focus reporting, alt screen, bracketed paste, sync output (2026).
Kitty keyboardQuery / push / pop progressive enhancement levels.
Library modeInspector::parse(\$bytes) yields Segment values you can iterate.

Source & demos

Try the quickstart →

Demos.

VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.

Inspect

Inspect

Annotating SGR / OSC / DCS / APC streams in real time.