24-bit truecolor (semicolons)
AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Experimental
24-bit truecolor (semicolons) uses SGR 38;2 and 48;2 with semicolon-separated RGB values to set foreground and background to any of 16.7 million colors.
Syntax
CSI 38;2;r;g;b m SGR — Set foreground to RGB color
CSI 48;2;r;g;b m SGR — Set background to RGB color
Formal syntax
SGR-fg-rgb = 0x1b, "[", "38", ";", "2", ";", r, ";", g, ";", b, "m" ;
SGR-bg-rgb = 0x1b, "[", "48", ";", "2", ";", r, ";", g, ";", b, "m" ;
r = digit, { digit } ; (* red: 0-255 *)
g = digit, { digit } ; (* green: 0-255 *)
b = digit, { digit } ; (* blue: 0-255 *)
digit = "0" | "1" | "2" | "3" | "4"
| "5" | "6" | "7" | "8" | "9" ;Parameters
| Parameter | Description |
|---|---|
r | Red component (0-255) |
g | Green component (0-255) |
b | Blue component (0-255) |
Description
The semicolon-separated truecolor syntax is the most widely supported form of 24-bit RGB color in terminals. It extends the ECMA-48 SGR 38/48 color mechanism with 2 as the color space indicator, followed by the red, green, and blue components.
This syntax deviates from the ITU-T T.416 standard, which specifies colons as sub-parameter separators (see the colon variant). However, the semicolon form was adopted first by terminal emulators and has broader support.
Colors set via RGB are not affected by palette changes and always represent the exact specified color.
Examples
printf '\e[38;2;255;100;0mOrange text\e[0m\n'
printf '\e[48;2;0;0;128mNavy background\e[0m\n'
printf '\e[38;2;255;255;255;48;2;0;0;0mWhite on black\e[0m\n'
Specifications
| Specification | Section |
|---|---|
| XTerm ctlseqs | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | Yes | SGR 38;2;r;g;b - parsed by vte crate v0.15.0 |
| Bobcat | ? | ? | Implemented in external TerminalCtrl library, not in Bobcat source code |
| contour | ✓ | v0.1.0 | SGR 38;2;r;g;b and 48;2;r;g;b |
| foot | ✓ | Yes | SGR 38;2;r;g;b handled in csi.c:182-192 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | v20260216-nightly | |
| Kitty | ✓ | Yes | Present since early versions |
| Konsole | ✓ | Yes | SGR 38;2;r;g;b / 48;2;r;g;b / 58;2;r;g;b in src/Vt102Emulation.cpp:575-582 |
| mintty | ✓ | Yes | SGR 38;2;r;g;b and 48;2;r;g;b fully implemented at termout.c:2214-2222 and 2273-2285 |
| mlterm | ✓ | rel-3_1_6 | |
| PuTTY | ✓ | 0.71 | SGR 38;2;r;g;b implemented in commit a4cbd3df |
| Rio | ✓ | v0.0.3 | |
| rxvt-unicode | ✓ | rxvt-unicode-9.25 | |
| st | ✓ | 0.5 | |
| terminology | ✓ | v1.4.0 | Approximated to 256-color palette |
| VT100 | ✗ | No | |
| VTE | ✓ | Yes | SGR 38;2;r;g;b supported in collect_sgr_color semicolon branch |
| WezTerm | ✓ | Yes | Implemented via SGR 38;2;r;g;b - see wezterm-escape-parser/src/csi.rs:2524-2535 |
| Windows Terminal | ✓ | Yes | SGR 38;2;r;g;b handled in _SetRgbColorsHelper via GraphicsOptions::RGBColorOrFaint |
| xterm | ✓ | Yes | SGR 38;2;r;g;b supported for compatibility with KDE konsole. Requires OPT_DIRECT_COLOR for true 24-bit, otherwise uses closest palette match |
| xterm.js | ✓ | 0.3 | |
| Multiplexers | |||
| cy | ✓ | Yes | |
| GNU Screen | ✓ | v.5.0.0 | |
| tmux | ✓ | 2.2 | SGR 38;2;r;g;b and 48;2;r;g;b |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.12.0 | |
See also
- 24-bit truecolor (colons) — T.416-conformant colon syntax
- 256-color indexed — 256-color palette
- Standard ANSI colors — 8+8 basic colors