ANSI escape-sequence 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.
composer require sugarcraft/sugar-spark
$ 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
Inspector::parse(\$bytes) yields Segment values you can iterate.| Class | Method | Description |
|---|---|---|
| Inspector | parse(bytes) | Parse ANSI bytes into segments |
| Segment | type | Segment type (SGR, CSI, OSC, etc.) |
| Segment | content | Segment content |
| Segment | description() | Human-readable description |
VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.