OSC 105 Reset Special Color
Put xterm's special colors back as they started.
OSC 105 ; Pc ST
OSC 105 ; Pc ST puts special color Pc back as the terminal started it, undoing OSC 5. Pc is 0 to 4, for bold, underline, blink, reverse and italic, and with none, OSC 105 ST, all five are reset. It is OSC 104 with the numbering moved up by 256, and is read the same way, stopping at the first thing in the list that is not a number (ResetAnsiColorRequest). The same colors can be reset as palette numbers 256 to 260 with OSC 104.
In a default xterm it does not work. A reset sets the color again from its resource, colorBD and the rest, and each of those is XtDefaultForeground by default (charproc.c). That is the X Toolkit’s name for the default foreground, which the toolkit understands when it reads resources, but it is not a color name, and the reset looks it up as one, with XParseColor, which fails (xtermAllocColor). So the reset changes nothing, and a special color that has been changed stays changed. Starting up is not affected: when the lookup fails there, xterm falls back to the default foreground (xtermGetColorRes), which is why an unchanged special color is reported as black. A special color whose resource names a real color can be reset.
libghostty-vt has no special colors, and ignores OSC 5 and OSC 105, so the cases that ask are known differences.
Support
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | No | OSC is not among the controls it recognizes (§4.2) |
| VT510 | manual, 1st ed., 1993 | No | ignores an OSC string (chapter 4) |
| xterm | patch 412, xterm-411a | Partly | parses it, but cannot reset a special color whose resource is the default, XtDefaultForeground |
| libghostty-vt | 0f171f6 | No | no special colors (OSC105-1 to OSC105-3) |
| Konsole | 26.11.70, a24c3d71 | No | not in its source |
| ConEmu | build 230724, its documentation | No | not in its ANSI escape codes |
Validation
OSC105-1: Resetting one changes nothing
\e]5;0;red;1;blue\a # bold and underline
\e]105;0\a
\e]5;0;?;1;?\a
|____|
reply \e]5;0;rgb:ffff/0000/0000\a\e]5;1;rgb:0000/0000/ffff\a
OSC105-2: Nor does resetting them all
\e]5;0;red;1;blue\a
\e]105\a
\e]5;0;?;1;?\a
|____|
reply \e]5;0;rgb:ffff/0000/0000\a\e]5;1;rgb:0000/0000/ffff\a
OSC105-3: Nor through OSC 104, as color 256
\e]5;0;red\a
\e]104;256\a
\e]5;0;?\a
|____|
reply \e]5;0;rgb:ffff/0000/0000\a
OSC105-4: Nothing on screen
A
\e]5;0;red\a
\e]105;0\a
B
|AB__|
cursor 1,3