SGR 0 — Reset / Normal
Clear all text attributes and colors back to the terminal default.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[0m\\033[
\033[0m\\e[
\e[0mESC [
ESC [ 0 mhex
1b 5b 30 6dDescription
`SGR 0` (Select Graphic Rendition with parameter 0) resets every text attribute the terminal is currently tracking — foreground color, background color, bold, italic, underline, reverse video, blink, etc. It is equivalent to `\x1b[m` (the parameter defaults to 0 when omitted). Always emit this at the end of styled output so the next line of text is not 'colored by leak'.
Spec citation: ECMA-48 §8.3.117 (SGR)
Examples
printf '\033[31merror\033[0m\n'print('\x1b[31merror\x1b[0m')fmt.Print("\x1b[31merror\x1b[0m")process.stdout.write('\x1b[31merror\x1b[0m\n')printf("\x1b[31merror\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 |