Skip to content

256-color fg (SGR 38;5) โ€‹

Category: sgr ยท Tags: Xterm Extensions ยท Specification โ†—

ESC [ 38;5;N m
SGR 38;5;N sets the foreground to one of 256 colors. The sequence is ESC [ 38;5;N m where N is 0-255. Colors 0-7 are the standard colors, 8-15 are bright, 16-231 are a 6x6x6 color cube, and 232-255 are a grayscale ramp. This palette provides a reasonable range of colors that works across most modern terminals without requiring truecolor support.
How this is tested: Send \x1b[38;5;196mX (256-color red), verify the foreground red channel > 200.
Analysis2026-03-26

Supported by all 8 tested terminals โ€” universal adoption. Part of the Modern TUI baseline.

Supported by 11 of 13 backends (85%)

Terminal Applications โ€‹

TerminalVersionSupportNotes
iTerm23.6.9โœ“ yes
Ghostty1.3.1โœ“ yes
VS Code1.112.0โœ“ yes
Warp0.2026.03.18.08.24.03โœ“ yes
Cursor2.6.21โœ“ yes
tmux3.6aโœ“ yes
Kitty0.46.2โœ“ yes
Terminal.app2.15โœ“ yes
GNU Screen5.0.1โœ“ yes

Headless Backends โ€‹

Parser correctness only โ€” a โœ“ means the parser accepts the sequence.

BackendVersionSupportNotes
Alacritty0.26.0โœ“ yes
vterm0.2.0โœ“ yes
WezTerm0.1.0-fork.5~ partialBackend returns palette index instead of resolved RGB
vt1000.2.1โœ— noNot in VT100/VT220 โ€” only 8 standard colors supported

Powered by Termless
Playwright for Terminals