Skip to main content
ansicode

OSC 110 / 111 / 112 — Reset default fg / bg / cursor colour

Restore the terminal's user-default foreground, background, or cursor colour after OSC 10 / 11 / 12 overrode it.

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b]110\x07 (reset fg) \x1b]111\x07 (reset bg) \x1b]112\x07 (reset cursor)
\\033[\033]110\007 / \033]111\007 / \033]112\007
\\e[\e]110\a / \e]111\a / \e]112\a
ESC [ESC ] N BEL
hex1b 5d 31 31 30 / 31 31 31 / 31 31 32 07

Description

The reset partners of OSC 10 / 11 / 12 (set fg / bg / cursor colour). Sending one of these with no payload restores the value to whatever the user configured in their terminal preferences — much friendlier than guessing what to pass to OSC 10/11/12 to undo a temporary override. Apps that briefly remap default colours (theme-switchers, demos, terminal-recorders that need to capture a clean baseline) should always emit the corresponding `11X` on exit. OSC 112 is xterm-specific for the cursor; iTerm2 also supports it. Sending `\x1b]110\x07` is exactly equivalent to `\x1b]10;?\x07` followed by re-emitting whatever was queried — but with one round-trip-free byte.

Spec citation: xterm-ctlseqs (OSC 110 / 111 / 112)

Examples

bash
printf '\033]11;#000000\007'   # override bg to pure black\n# … later …\nprintf '\033]111\007'           # restore user default bg
python
import sys; sys.stdout.write('\x1b]111\x07')
go
fmt.Print("\x1b]111\x07")
javascript
process.stdout.write('\x1b]111\x07')
c
printf("\x1b]111\x07");

Terminal support

xterm
yes
Linux console (fbcon)
no
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

Related sequences

In the family cookbook

SGR cookbook · 5. OSC palette override — repaint the slot itself