Skip to content

Underline color, indexed (SGR 58;5)

Category: sgr · Baseline: rich · Tags: ECMA-48 Standard, Kitty Extensions · Specification ↗

CSI 58 ; 5 ; N m
SGR 58;5;N sets the underline color to one of the 256 indexed palette colors, mirroring the SGR 38;5 syntax used for foreground color. The sequence is ESC [ 58 ; 5 ; N m, where N is a palette index (0-15 system colors, 16-231 6×6×6 RGB cube, 232-255 grayscale ramp). The colon-separated form ESC [ 58 : 5 : N m is also accepted by terminals that support ECMA-48 sub-parameter syntax. Indexed underline color is widely supported on terminals that implement the broader Kitty extended underline protocol: Kitty, WezTerm, foot, Ghostty, VTE-based terminals (GNOME Terminal, Tilix), mintty, and iTerm2. Combine with curly underlines (SGR 4:3) to render diagnostic indicators in palette colors that match the user's theme. Reset the underline color to default (typically the foreground color) with SGR 59.
How this is testedautomated
Send \x1b[4m\x1b[58;5;5mX, verify the cell at (0,0) has underline active. If the backend tracks underline color per cell, also verify underlineColor matches palette index 5 (magenta).

The same probe runs against headless backends (via Termless) and real terminal apps (via a daemon launched in each terminal). This lets us distinguish parser correctness from rendering correctness.

Analysis2026-04-06

Supported by 8 of 9 terminals (89%). Not supported by: vt100.js. Part of the Rich TUI baseline. Notes: vt100.js: Colored underline (SGR 58) post-dates VT220 — not implemented in vt100.js baseline.

Supported by 8 of 14 backends (57%)

Terminal Applications

TerminalVersionSupportNotes
iTerm23.6.9✓ yes
Ghostty1.3.1✓ yes
Terminal.app2.15✓ yes
Kitty0.46.2✓ yesUnderline color not exposed via Python batch bridge
VS Code1.113.0? unknown
Warp0.2026.03.18.08.24.03? unknown
Cursor2.6.21? unknown

Headless Backends

Parser correctness only — a means the parser accepts the sequence.

BackendVersionSupportNotes
vterm0.2.0✓ yes
xterm.js5.5.0✓ yes
Alacritty0.26.0~ partialHeadless alacritty backend doesn't expose underlineColor on cells
WezTerm0.1.0-fork.5~ partialHeadless wezterm backend doesn't expose underlineColor on cells
vt100.js0.2.1✗ noColored underline (SGR 58) post-dates VT220 — not implemented in vt100.js baseline