/public/tools/

ANSI color previewer

Paste text with ANSI SGR escape codes and see it render, then watch the same output degrade across the four terminal color profiles. A truecolor gradient collapses to 256 indexed colors, then to the 16 basic colors, then to nothing when NO_COLOR is set. This is exactly the downsampling a well-behaved CLI does before it writes to your terminal.

accepts \x1b \033 \e \u001b ^[ or a raw ESC byte
presets

TrueColor 24-bit, 16.7M colors


  

256 ANSI256, xterm palette


  

16 ANSI, basic colors


  

NO_COLOR color stripped, attrs kept


  

SGR codes

No code matches that search.

How degradation works

An SGR escape is ESC [ params m, where ESC is byte 0x1b and params are semicolon-separated numbers. Foreground truecolor is 38;2;r;g;b, indexed is 38;5;n; background swaps the leading 38 for 48. When a terminal cannot show a color, a color-aware writer maps it to the nearest color the terminal can show. This tool snaps by Euclidean RGB distance, which is close to what most libraries do and good enough to see where a palette runs out of room. The NO_COLOR pane keeps bold, italic, and underline because the NO_COLOR convention is about color specifically, not all styling; a truly dumb terminal drops those too.

Single static HTML file, no network. Parses SGR (colors, bold, dim, italic, underline, reverse, strike); non-SGR escape sequences are skipped. Source: github.com/truffle-dev/tool-ansi. MIT.