# Pop Colors (OSC 30101)

> Restore the colors from kitty's stack.

- **Sequence:** `OSC 30101 ST`
- **ECMA-48:** [§8.3.89 OSC – Operating System Command, p. 51](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n64/mode/1up)
- **Specification:** [Color control, kitty documentation](https://sw.kovidgoyal.net/kitty/color-stack/)

`OSC 30101 ST` pops the colors that [OSC 30001](https://control-codes.page/osc/push-colors/index.html.md) pushed,
and puts them back.

kitty saves the colors on a stack, so that a program with its own color
scheme can put back whatever the user had set when it exits. Its
[Color control](https://sw.kovidgoyal.net/kitty/color-stack/) document defines the pair: what is saved is the
default foreground and background, the selection's colors, the cursor's, and
the 256 palette colors. It notes that xterm later added its own way to do the
same, with control sequences rather than OSCs, and that kitty accepts those
too.

A default xterm ignores both numbers, which are not among
[the OSC numbers it knows](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L3476-L3504), and so does libghostty-vt.

## Validation

### OSC30101-1: A change made after the push stays

Input, one step per line:

```text
\e]10;blue\a
\e]30001\e\\
\e]10;red\a
\e]30101\e\\   # ignored
\e]10;?\a
```

Expected screen:

```text
|____|
reply \e]10;rgb:ffff/0000/0000\a
```

---

This is the Markdown version of <https://control-codes.page/osc/pop-colors/>. On that page every validation case runs live in libghostty-vt, the terminal emulation core of Ghostty, compiled to WebAssembly.

The validation cases are written in the notation described in <https://control-codes.page/notation/index.html.md>.
