SGR 48;2;R;G;B — 24-bit truecolor background
Pick any of 16,777,216 background RGB colors directly.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[48;2;R;G;Bm\\033[
\033[48;2;R;G;Bm\\e[
\e[48;2;R;G;BmESC [
ESC [ 4 8 ; 2 ; R ; G ; B mhex
1b 5b 34 38 3b 32 3b ... 6dDescription
Background sibling of `\x1b[38;2;R;G;Bm`. R, G, B are each 0–255. The ECMA-48-compliant colon form `\x1b[48:2::R:G:Bm` (empty 4th sub-parameter = colorspace ID) is accepted alongside the more common semicolon form. Check `$COLORTERM=truecolor` (or `24bit`) before emitting in cross-environment tools — terminals lacking truecolor will quantize to 256-color, which may or may not look acceptable.
Spec citation: ITU-T T.416 / xterm-ctlseqs (Direct color)
Examples
printf '\033[48;2;30;30;30;38;2;255;200;0m on graphite \033[0m\n'print('\x1b[48;2;30;30;30m bg \x1b[0m')fmt.Print("\x1b[48;2;30;30;30m bg \x1b[0m")console.log('\x1b[48;2;30;30;30m bg \x1b[0m')printf("\x1b[48;2;30;30;30m bg \x1b[0m\n");Terminal support
- xterm
- yes
- Linux console (fbcon)
- no
- macOS Terminal.app
- partial
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- partial
- 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 | no | partial | yes | yes | partial | yes | yes | yes | yes | yes | yes | no | no |