Terminal Guide

256 Color Foreground

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

Change foreground color to specific palette color.

This has multiple possible forms.

Attribute
(1)38:5:Ⓝadditional subparameters are ignored
(2)38;5:Ⓝadditional subparameters are ignored
(3)38;5;Ⓝ

The color palette can be modified by change/read palette color, set attribute replacement colors, Sequence not found: osc-6, activate/deactivate attribute replacement colors, reset palette colors and reset attribute replacement colors.

The default palette is the following:

The color codes 0-7 alias the colors as set with 8 colors foreground and color codes 8-15 alias the colors as set with bright 8 color foreground. The indexes 16-231 form a 6x6x6 rgb color cube. Indexes 232-255 form a grey ramp not touching black and white.

The color cube uses intensity levels of [0, 95, 135, 175, 215, 255] and calculates the components as red is (index-16) / 36, green is (index-16) / 6) % 6 and blue (index-16) % 6.

The grey ramp uses the intensity levels of [8, 18, 28, 38, 48, 58, 68, 78, 88, 98, 108, 118, 128, 138, 148, 158, 168, 178, 188, 198, 208, 218, 228, 238]

Note: Some terminals have compilation options to use an alternate 88 color palette system.

urxvt ( ✓ )

urxvt supports only form 3.

xterm ( ✔ )

xterm supports forms 1, 2 and 3.

vte ( ✔ )

xterm supports forms 1 and 3.

konsole ( ✓ )

konsole supports only form 3.

linuxvc ( ✓ )

🛈 linuxvc only supports form 3. 🛈 linuxvc uses a hardcoded palette. (even colors 0-15 need not match named colors) 🛆 linuxvc approximates from an 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.