Skip to main content
ansicode

SGR 49 — Default background color

Reset only the background color (leaves attributes + fg intact).

Byte forms

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

\\x1b[\x1b[49m
\\033[\033[49m
\\e[\e[49m
ESC [ESC [ 4 9 m
hex1b 5b 34 39 6d

Description

Restores the background to the terminal's theme default without disturbing the foreground, bold/italic/underline, or other SGR state. The complement of `\x1b[39m` (default foreground). Commonly used to end a 'banner' line (colored background) and return to the normal terminal background without resetting text color.

Spec citation: ECMA-48 §8.3.117 (SGR parameter 49)

Examples

bash
printf '\033[41;37m WARNING \033[49m text\033[0m\n'
python
print('\x1b[41mred bg\x1b[49m default bg\x1b[0m')
go
fmt.Print("\x1b[41mred bg\x1b[49m default bg\x1b[0m")
javascript
console.log('\x1b[41mred bg\x1b[49m default bg\x1b[0m')
c
printf("\x1b[41mred bg\x1b[49m default bg\x1b[0m\n");

Terminal support

xterm
yes
Linux console (fbcon)
yes
macOS Terminal.app
yes
iTerm2
yes
Windows Terminal
yes
cmd.exe / ConPTY
yes
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 · 2. 16-color basic — `\x1b[31m` and friends