Skip to content

OSC 5 — "Special" Color Set

SequenceOSC 5 ; <slot> ; rgb:R/G/B ST (set) · OSC 5 ; <slot> ; ? ST (query)
Otty support✓ parsed and stored · underline (slot 1) consulted as fallback when no SGR 58 is active on the cell

Description

xterm-style "special color" slots — colors that decorate one of the SGR attributes globally rather than per-cell. Less widely used than OSC 10/11/12 but a small number of programs (kitty themes, the base16 schemes, some debuggers' integrated REPLs) emit them.

<slot>Meaning
0Bold-text color
1Underline color (default; SGR 58 still overrides per-cell)
2Blink color
3Reverse-video color
4Italic-text color

Per-cell SGR 58 (\e[58:2::R:G:B) wins over slot 1 — that's xterm's documented precedence. Otty treats the OSC 5 underline color as the default underline tint applied when the cell has no explicit SGR 58.

Reset

The companion sequence is OSC 105: OSC 105 ST resets all five slots; OSC 105 ; 1 ; 4 ST resets just slots 1 and 4.

Example

bash
# Make undercurl underlines render in red even when no SGR 58 is set
printf '\e]5;1;#ff5555\e\\'
printf '\e[4:3mtypo without SGR 58\e[0m\n'

# Restore
printf '\e]105;1\e\\'

Notes

  • Bold / blink / reverse / italic slots are stored but Otty's renderer doesn't currently consult them — bold uses its own bold-color config + bold-is-bright toggle, italics use the per-cell SGR fg, and Otty doesn't blink. The values are queryable, kept in the per-session overrides table, and will be wired through when a follow-up feature needs them.

Otty