24-bit truecolor (colons)
24-bit truecolor (colons) uses the ITU-T T.416 sub-parameter syntax with colons to set foreground and background to an RGB color.
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
SGR-fg-rgb-colon = 0x1b, "[", "38:2::", r, ":", g, ":", b, "m" ;
SGR-bg-rgb-colon = 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
Per ITU-T T.416 (ISO 8613-6), the colon-separated form is the standard way to specify extended colors in SGR. The full format is 38:2:colorspace:r:g:b where the color space ID (between 2 and r) is typically omitted (empty, defaulting to implementation-defined).
The double colon in 38:2::r:g:b represents the omitted color space parameter. Some terminals also accept 38:2:r:g:b (with a single colon, treating the color space as absent rather than empty).
The colon syntax is technically more correct than the semicolon variant (38;2;r;g;b) because colons separate sub-parameters within a single SGR parameter, while semicolons separate distinct SGR parameters. This matters when combining multiple SGR attributes in one sequence.
Support for the colon form is less universal than the semicolon form, but is growing. Applications that need maximum compatibility should prefer the semicolon syntax.
Examples
printf '\e[38:2::255:100:0mOrange text\e[0m\n'
printf '\e[48:2::0:0:128mNavy background\e[0m\n'
Specifications
| Specification | Section |
|---|---|
| ITU-T T.416 | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ? | ? | SGR 38:2::r:g:b - vte crate support unclear |
| 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 - T.416 format |
| foot | ✓ | Yes | SGR 38:2::r:g:b with/without color space, csi.c:203-231 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | v20260216-nightly | |
| Kitty | ✓ | Yes | ITU T.416 format with colon separators |
| Konsole | ✓ | Yes | SGR 38:2::r:g:b / 48:2::r:g:b / 58:2::r:g:b with optional color space ID in src/Vt102Emulation.cpp:583-594 |
| mintty | ✓ | Yes | SGR 38:2::r:g:b and 48:2::r:g:b implemented at termout.c:2224-2239 and 2287-2314 (ISO/IEC 8613-6 T.416 format with colon separators) |
| mlterm | ✗ | No | Parser only handles semicolon separators, not colons |
| PuTTY | ✗ | No | CSI parser only handles semicolons, not colons as separators |
| Rio | ✓ | v0.0.3 | |
| rxvt-unicode | ✗ | No | Only semicolon syntax (38;2;r;g;b) supported |
| st | ~ | 0.9.3 | Supports 38;2;r:g:b hybrid format but not T.416 38:2::r:g:b format |
| terminology | ✓ | v1.4.0 | Approximated to 256-color palette |
| VT100 | ✗ | No | |
| VTE | ✓ | Yes | SGR 38:2::r:g:b supported in collect_sgr_color colon branch |
| WezTerm | ✓ | Yes | Implemented via SGR 38:2::r:g:b with optional colorspace parameter - see wezterm-escape-parser/src/csi.rs:2488-2522 |
| Windows Terminal | ✓ | Yes | SGR 38:2::r:g:b with subparams via _SetRgbColorsHelperFromSubParams |
| xterm | ✓ | Yes | SGR 38:2::r:g:b (ISO-8613-6 standard format) supported. Requires OPT_DIRECT_COLOR for true 24-bit, otherwise uses closest palette match |
| xterm.js | ✓ | 4.0.0 | |
| Multiplexers | |||
| cy | ✗ | No | Only semicolon format (38;2;r;g;b) is supported |
| GNU Screen | ✗ | No | |
| tmux | ✓ | 2.7 | SGR 38:2::r:g:b - ISO colon-separated format |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.12.0 | |
See also
- 24-bit truecolor (semicolons) — Widely supported semicolon syntax
- 256-color indexed — 256-color palette