^[control-codes
live in libghostty-vt

Operating system commands

OSC 105 Reset Special Color

View as Markdown

Put xterm's special colors back as they started.

OSC 105 ; Pc ST
ECMA-48
§8.3.89 OSC – Operating System Command, p. 51
xterm
Operating System Commands

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

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984NoOSC is not among the controls it recognizes (§4.2)
VT510manual, 1st ed., 1993Noignores an OSC string (chapter 4)
xtermpatch 412, xterm-411aPartlyparses it, but cannot reset a special color whose resource is the default, XtDefaultForeground
libghostty-vt0f171f6Nono special colors (OSC105-1 to OSC105-3)
Konsole26.11.70, a24c3d71Nonot in its source
ConEmubuild 230724, its documentationNonot 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
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.