OSC R Reset Palette (Linux)
Put the palette back, as the Linux console does.
OSC R ST
- ECMA-48
- §8.3.89 OSC – Operating System Command, p. 51
- Specification
- console_codes(4), Linux manual pages
OSC R ST puts the Linux console’s sixteen colors back as they started, undoing OSC P. OSC 104 is the way to do the same in xterm and the terminals that follow it.
The Linux console’s own definition, in console_codes(4), has no terminator: ESC ] P takes exactly seven hex digits after it, and ESC ] R none at all. Every other terminal reads them as OSCs, which run until ST or BEL, so sent the console’s way, one of these swallows whatever follows it until something ends the string.
A default xterm ignores both: a letter it does not know where the number should be makes the sequence malformed (do_osc). libghostty-vt ignores them too.
Validation
OSC-R-1: It does not reset the palette
\e]4;1;red\a
\e]R\e\\
\e]4;1;?\a
|______|
reply \e]4;1;rgb:ffff/0000/0000\a
OSC-R-2: Without a terminator, it swallows what follows
\e]R # the console's way
AB
|______|