Terminal Guide

Direct Color Foreground

Set: 38:2:...
Reset: 39
urxvt
xterm
vte
konsole
linuxvc

Set foreground color as RGB values.

The color is specified as separate values for each color component. Values are in the range 0 to 255 (inclusive). The order is red, green, blue.

This has multiple possible forms.

Attribute
(1)38:2:Ⓝ:Ⓝ:Ⓝ
(2)38:2:Ⓝ:Ⓝ:Ⓝ:Ⓝthe first Ⓝ is supposed to be a color space indication, but is just ignored in practice; additional subparameters are ignored
(3)38;2:Ⓝ:Ⓝ:Ⓝadditional subparameters are ignored
(4)38;2;Ⓝ;Ⓝ;Ⓝ

urxvt ( ✓ )

urxvt supports only form 4.

urxvt uses a set of dynamic color slots and overwrites the least recently used in the proximity of the target color. Real usage should yield much better result than the demonstration color ramps.

xterm ( ✔ )

xterm supports forms 1, 2, 3 and 4.

vte ( ✓ )

🛈 vte supports forms 1 and 4. 🛆 Form 2 is supported when the color space id is empty (defaulted). Any digit in the color space id prevents this form from working (subparameters are still consumed) 🛈 Form 2 with any color space was accepted before version 0.42.

konsole ( ✓ )

konsole supports only form 4.

linuxvc ( ✓ )

🛈 linuxvc only supports form 4. 🛆 linuxvc approximates from a 8 or 16 color palette, by extracting a hue and brightness and selecting one of the 8 named colors and an intensity from that. See faint and bright 8 color foreground for how intensity is rendered depending on configuration.