OSC 104 — Reset palette colour (one index or all)
Restore one palette index — or the whole 256-colour palette — to the terminal's user-configured defaults.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b]104;N\x07 (reset index N) \x1b]104\x07 (reset all)\033]104;N\007 / \033]104\007\e]104;N\a / \e]104\aESC ] 104 ; N BEL / ESC ] 104 BEL1b 5d 31 30 34 3b <N> 07 / 1b 5d 31 30 34 07Description
OSC 104 is the reset partner of OSC 4 (set palette colour). With one numeric argument (`\x1b]104;N\x07`) it restores palette index `N` (0..255) to the user-configured default; with no argument (`\x1b]104\x07`) it resets every entry in the working palette at once. Multiple indices can be reset in one frame as a `;`-separated list (`\x1b]104;0;1;7\x07`). Used by base16-themes, pywal, and recording tools on exit to undo any OSC 4 overrides they applied during the session — without this the next shell that inherits the same terminal would see the modified palette. Pair OSC 104 with OSC 110 / 111 / 112 (reset default fg / bg / cursor — see osc-reset-fg-bg) to fully unwind a colour-management session.
Spec citation: xterm-ctlseqs (OSC 104)
Examples
printf '\033]104;1\007' # reset palette index 1 (red)\nprintf '\033]104\007' # reset entire palette\nprintf '\033]104;0;1;7\007' # reset indices 0, 1, 7 in one frameimport sys; sys.stdout.write('\x1b]104\x07') # reset whole palettefmt.Print("\x1b]104\x07")process.stdout.write('\x1b]104\x07')printf("\x1b]104\x07");Terminal support
- xterm
- yes
- Linux console (fbcon)
- partial
- macOS Terminal.app
- partial
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- no
- kitty
- yes
- alacritty
- yes
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- yes
- Konsole
- yes
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | partial | partial | yes | yes | no | yes | yes | yes | yes | yes | yes | no | no |
Related sequences
In the family cookbook
SGR cookbook · 5. OSC palette override — repaint the slot itself