Underline color (indexed)
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 (indexed) uses SGR 58;5 to set the underline color to a 256-color palette index, independently of the foreground color.
Syntax
CSI 58;5;n m SGR — Set underline color to indexed color n
CSI 59 m SGR — Reset underline color to default
Formal syntax
SGR-underline-color-idx = 0x1b, "[", "58", ";", "5", ";", n, "m" ;
SGR-underline-default = 0x1b, "[", "59", "m" ;
n = digit, { digit } ; (* 0-255 *)
digit = "0" | "1" | "2" | "3" | "4"
| "5" | "6" | "7" | "8" | "9" ;Parameters
| Parameter | Description |
|---|---|
n | Color index (0-255), same palette as SGR 38;5 |
Description
SGR 58 sets the underline color using the same mechanism as SGR 38 (foreground color), but applied to the underline decoration instead. The ;5;n sub-parameters select indexed color mode with index n.
SGR 59 resets the underline color to the default (which is typically the foreground color).
This feature is defined in ITU-T T.416 and was popularized by the Kitty terminal. It allows underline decorations (straight, double, curly, dotted, dashed) to be colored independently of the text, which is useful for diagnostic indicators and code annotations.
Examples
# Red curly underline on normal text
printf '\e[4:3;58;5;9mError here\e[0m\n'
# Yellow underline with white text
printf '\e[4;37;58;5;11mWarning\e[0m\n'
Specifications
| Specification | Section |
|---|---|
| Kitty Underlines Extension | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | Yes | SGR 58;5;n - parameter 58 explicitly listed in escape_support.md |
| Bobcat | ? | ? | Implemented in external TerminalCtrl library, not in Bobcat source code |
| contour | ✓ | v0.3.6.240 | SGR 58;5;n and 58:5:n |
| foot | ✓ | Yes | SGR 58;5;n handled in csi.c:194-201 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | v20260216-nightly | |
| Kitty | ✓ | Yes | SGR 58;5;n supported |
| Konsole | ✓ | Yes | SGR 58;5;n handled in src/Vt102Emulation.cpp:602-605, stored via setULColor in src/Screen.cpp:1726 |
| mintty | ✓ | Yes | SGR 58:5:n implemented at termout.c:2319-2324 using colon-separated sub-parameters (ISO/IEC 8613-6 format) |
| mlterm | ✗ | No | |
| PuTTY | ✗ | No | SGR 58 not implemented; no underline color support |
| Rio | ✓ | v0.0.3 | |
| rxvt-unicode | ✗ | No | |
| st | ✗ | No | SGR 58 sequences are eaten but not applied (st.c:1436-1441) |
| terminology | ✗ | No | |
| VT100 | ✗ | No | |
| VTE | ✓ | Yes | SGR 58;5;n supported via DECO_SPEC in collect_sgr_color |
| WezTerm | ✓ | Yes | Implemented via SGR 58;5;n and 58:5:n - see wezterm-escape-parser/src/csi.rs:2752-2753 |
| Windows Terminal | ✓ | Yes | SGR 58;5;n via UnderlineColor (58) with 256-color index support |
| xterm | ✗ | No | No evidence of SGR 58;5;n support in source code or documentation |
| xterm.js | ✓ | 4.6.0 | |
| Multiplexers | |||
| cy | ✗ | No | |
| GNU Screen | ✗ | No | |
| tmux | ✓ | 3.0a | SGR 58;5;n - Requires Setulc capability |
| tuios | ✓ | v0.2.0 | |
| Zellij | ✓ | v0.39.0 | |
See also
- Underline color (RGB) — Set underline color via RGB
- Underline — SGR 4 — Enable underline
- Curly underline — SGR 4:3 — Wavy underline style