SGR 38;2;R;G;B — 24-bit truecolor foreground
Pick any of 16,777,216 foreground RGB colors directly.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[38;2;R;G;Bm\\033[
\033[38;2;R;G;Bm\\e[
\e[38;2;R;G;BmESC [
ESC [ 3 8 ; 2 ; R ; G ; B mhex
1b 5b 33 38 3b 32 3b ... 6dDescription
R, G, B are each 0–255. Background equivalent: `\x1b[48;2;R;G;Bm`. Many parsers accept either the semicolon form (xterm/legacy) or the ECMA-48-compliant colon form `\x1b[38:2::R:G:Bm` (note the empty 4th sub-parameter for the colorspace ID). Truecolor is the right default for modern emulators; check `$COLORTERM=truecolor` or `24bit` before emitting in cross-environment tools.
Spec citation: ITU-T T.416 / xterm-ctlseqs (Direct color)
Examples
printf '\033[38;2;255;128;0morange\033[0m\n'print('\x1b[38;2;255;128;0morange\x1b[0m')fmt.Print("\x1b[38;2;255;128;0morange\x1b[0m\n")console.log('\x1b[38;2;255;128;0morange\x1b[0m')printf("\x1b[38;2;255;128;0morange\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 |