Skip to main content

Underline color (RGB)

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Experimental

Underline color (RGB) uses SGR 58;2 to set the underline color to an arbitrary 24-bit RGB value, independently of the foreground color.

Syntax​

CSI 58;2;r;g;b m    SGR — Set underline color to RGB
CSI 59 m SGR — Reset underline color to default
Formal syntax
SGR-underline-color-rgb = 0x1b, "[", "58", ";", "2", ";", r, ";", g, ";", b, "m" ;
SGR-underline-default   = 0x1b, "[", "59", "m" ;
r                       = digit, { digit } ;       (* red: 0-255 *)
g                       = digit, { digit } ;       (* green: 0-255 *)
b                       = digit, { digit } ;       (* blue: 0-255 *)
digit                   = "0" | "1" | "2" | "3" | "4"
                      | "5" | "6" | "7" | "8" | "9" ;

Parameters​

ParameterDescription
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)

Description​

SGR 58;2 sets the underline color to an RGB value using the same syntax as SGR 38;2 (foreground RGB), but applied to the underline decoration. This allows precise color control of underline decorations independently of the text color.

SGR 59 resets the underline color to the default (typically the foreground color).

The colon-separated form SGR 58:2::r:g:b is also valid (per ITU-T T.416) and is accepted by some terminals.

Examples​

# Red curly underline with RGB color
printf '\e[4:3;58;2;255;0;0mError here\e[0m\n'

# Orange underline on normal text
printf '\e[4;58;2;255;165;0mWarning\e[0m\n'

Specifications​

SpecificationSection
Kitty Underlines Extension—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓YesSGR 58;2;r;g;b - parameter 58 explicitly listed
Bobcat??Implemented in external TerminalCtrl library, not in Bobcat source code
contour✓v0.3.6.240SGR 58;2;r;g;b and 58:2::r:g:b
foot✓YesSGR 58;2;r;g;b and 58:2 handled in csi.c:168-256
Ghostty✓v1.0.0
iTerm2✓v20260216-nightly
Kitty✓YesSGR 58;2;r;g;b supported
Konsole✓YesSGR 58;2;r;g;b handled in src/Vt102Emulation.cpp:575-594, stored via setULColor
mintty✓YesSGR 58:2:r:g:b implemented at termout.c:2325-2333 using colon-separated sub-parameters (ISO/IEC 8613-6 format)
mlterm✗No
PuTTY✗NoSGR 58 not implemented; no underline color support
Rio✓v0.0.3
rxvt-unicode✗No
st✗NoSGR 58 sequences are eaten but not applied (st.c:1436-1441)
terminology✗No
VT100✗No
VTE✓YesSGR 58;2;r;g;b supported via DECO_SPEC in collect_sgr_color
WezTerm✓YesImplemented via SGR 58;2;r;g;b and 58:2:r:g:b - see wezterm-escape-parser/src/csi.rs:2752-2753
Windows Terminal✓YesSGR 58;2;r;g;b via UnderlineColor (58) with RGB color support
xterm✗NoNo evidence of SGR 58;2;r;g;b support in source code or documentation
xterm.js✓4.6.0
Multiplexers
cy✗No
GNU Screen✗No
tmux✓3.0aSGR 58;2;r;g;b - Requires Setulc capability
tuios✓v0.2.0
Zellij✓v0.39.0

See also​