Skip to content

Underline color, truecolor (SGR 58;2)

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

CSI 58 ; 2 ; R ; G ; B m
SGR 58;2;R;G;B sets the underline color to a 24-bit truecolor value, mirroring the SGR 38;2 syntax used for foreground color. The sequence is ESC [ 58 ; 2 ; R ; G ; B m, where R, G, and B are 0-255. The ECMA-48 colon-separated form ESC [ 58 : 2 : : R : G : B m (with an empty colorspace ID slot) is also accepted by terminals that follow the strict spec. Truecolor underlines were originally introduced by Kitty and have since been adopted by every major modern terminal: WezTerm, foot, Ghostty, Alacritty, VTE (GNOME Terminal, Tilix), iTerm2, mintty, Konsole, and Windows Terminal. The underline color is independent of the text foreground color, so applications can render red squiggly underlines for errors and yellow squigglies for warnings while keeping the surrounding text in its normal color. Reset the underline color to default (typically matching the foreground) with SGR 59.
How this is testedautomated
Send \x1b[4m\x1b[58;2;255;0;128mX, verify the cell at (0,0) has underline active. If the backend tracks underline color per cell, also verify underlineColor matches RGB(255, 0, 128).

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