Skip to main content

24-bit truecolor (colons)

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!
Standard

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
Formal syntax
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​

ParameterDescription
rRed component (0-255)
gGreen component (0-255)
bBlue 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​

SpecificationSection
ITU-T T.416—

Terminal support​

TerminalSupportVersionNotes
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.0SGR 38:2::r:g:b and 48:2::r:g:b - T.416 format
foot✓YesSGR 38:2::r:g:b with/without color space, csi.c:203-231
Ghostty✓v1.0.0
iTerm2✓v20260216-nightly
Kitty✓YesITU T.416 format with colon separators
Konsole✓YesSGR 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✓YesSGR 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✗NoParser only handles semicolon separators, not colons
PuTTY✗NoCSI parser only handles semicolons, not colons as separators
Rio✓v0.0.3
rxvt-unicode✗NoOnly semicolon syntax (38;2;r;g;b) supported
st~0.9.3Supports 38;2;r:g:b hybrid format but not T.416 38:2::r:g:b format
terminology✓v1.4.0Approximated to 256-color palette
VT100✗No
VTE✓YesSGR 38:2::r:g:b supported in collect_sgr_color colon branch
WezTerm✓YesImplemented via SGR 38:2::r:g:b with optional colorspace parameter - see wezterm-escape-parser/src/csi.rs:2488-2522
Windows Terminal✓YesSGR 38:2::r:g:b with subparams via _SetRgbColorsHelperFromSubParams
xterm✓YesSGR 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✗NoOnly semicolon format (38;2;r;g;b) is supported
GNU Screen✗No
tmux✓2.7SGR 38:2::r:g:b - ISO colon-separated format
tuios✓v0.0.15
Zellij✓v0.12.0

See also​