SGR 39 — Default foreground color
Reset only the foreground color (leaves attributes + bg intact).
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[39m\\033[
\033[39m\\e[
\e[39mESC [
ESC [ 3 9 mhex
1b 5b 33 39 6dDescription
Resets the foreground to the terminal's theme default without disturbing the background, bold/italic/underline, or other SGR state. The complement of `\x1b[49m` (default background). Useful when you want to switch fg colors mid-line without emitting a full SGR 0 reset and re-applying every attribute.
Spec citation: ECMA-48 §8.3.117 (SGR parameter 39)
Examples
printf '\033[1;31mERROR\033[39m bold continues\033[0m\n'print('\x1b[31mred\x1b[39m default\x1b[0m')fmt.Print("\x1b[31mred\x1b[39m default\x1b[0m")console.log('\x1b[31mred\x1b[39m default\x1b[0m')printf("\x1b[31mred\x1b[39m default\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
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | no | no |