Colors
Text color is manipulated using CSI n m sequence.
Intensity | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
---|---|---|---|---|---|---|---|---|
Normal | Black | Red | Green | Yellow | Blue | Magenta | Cyan | White |
Bright | Black | Red | Green | Yellow | Blue | Magenta | Cyan | White |
There are two other color standards CSS/HTML standard colors and X Window colors which standardize both the color names and associated RGB color values, but the escape sequence standard only specifies the color names, not RGB values. The chart below shows default RGB assignments for some common terminal programs, together with the CSS and the X-Window colors for these color names.
Color name | Standard VGA colors | Windows XP command prompt |
Terminal.app | PuTTY | xterm | CSS/HTML | X Window | |
---|---|---|---|---|---|---|---|---|
Normal | Black | 0, 0, 0 | 0, 0, 0 | 0, 0, 0 | 0, 0, 0 | 0, 0, 0 | 0, 0, 0 | 0, 0, 0 |
Red | 170, 0, 0 | 128, 0, 0 | 194, 54, 33 | 187, 0, 0 | 205, 0, 0 | 255, 0, 0 | 255, 0, 0 | |
Green | 0, 170, 0 | 0, 128, 0 | 37, 188, 36 | 0, 187, 0 | 0, 205, 0 | 0, 255, 0 | 0, 128, 0 | |
Brown/yellow | 170, 85, 0 | 128, 128, 0 | 173, 173, 39 | 187, 187, 0 | 205, 205, 0 | 255, 255, 0 | 255, 255, 0 | |
Blue | 0, 0, 170 | 0, 0, 128 | 73, 46, 225 | 0, 0, 187 | 0, 0, 238 | 0, 0, 255 | 0, 0, 255 | |
Magenta | 170, 0, 170 | 128, 0, 128 | 211, 56, 211 | 187, 0, 187 | 205, 0, 205 | 255, 0, 255 | 255, 0, 255 | |
Cyan | 0, 170, 170 | 0, 128, 128 | 51, 187, 200 | 0, 187, 187 | 0, 205, 205 | 0, 255, 255 | 0, 255, 255 | |
Gray | 170, 170, 170 | 192, 192, 192 | 203, 204, 205 | 187, 187, 187 | 229, 229, 229 | 255, 255, 255 | 255, 255, 255 | |
Bright/light | Darkgray | 85, 85, 85 | 128, 128, 128 | 129, 131, 131 | 85, 85, 85 | 127, 127, 127 | ||
Red | 255, 85, 85 | 255, 0, 0 | 252,57,31 | 255, 85, 85 | 255, 0, 0 | |||
Green | 85, 255, 85 | 0, 255, 0 | 49, 231, 34 | 85, 255, 85 | 0, 255, 0 | 144, 238, 144 | 144, 238, 144 | |
Yellow | 255, 255, 85 | 255, 255, 0 | 234, 236, 35 | 255, 255, 85 | 255, 255, 0 | 255, 255, 224 | 225, 255, 224 | |
Blue | 85, 85, 255 | 0, 0, 255 | 88, 51, 255 | 85, 85, 255 | 92, 92, 255 | 173, 216, 230 | 173, 216, 230 | |
Magenta | 255, 85, 255 | 255, 0, 255 | 249, 53, 248 | 255, 85, 255 | 255, 0, 255 | |||
Cyan | 85, 255, 255 | 0, 255, 255 | 20, 240, 240 | 85, 255, 255 | 0, 255, 255 | 224, 255, 255 | 224, 255, 255 | |
White | 255, 255, 255 | 255, 255, 255 | 233, 235, 235 | 255, 255, 255 | 255, 255, 255 |
The VGA column denotes the typical colors that are used when booting PCs and leaving them in their classical 80×25 text mode. The colors are different in the EGA/VGA graphic modes.
In July 2004, the blue colors of xterm changed, RGB (0,0,205) → (0,0,238) for normal and (0,0,255) → (92,92,255) for bright. As of 2010, old xterm versions still linger on many computers though.
Recent-enough versions of KDE's Konsole program support 24-bit foreground and background color setting:
https://github.com/robertknight/konsole/blob/master/tests/color-spaces.pl QuotingRead more about this topic: ANSI Escape Code
Famous quotes containing the word colors:
“All our Concord waters have two colors at least; one when viewed at a distance, and another, more proper, close at hand.... Walden is blue at one time and green at another, even from the same point of view. Lying between the earth and the heavens, it partakes of the color of both.”
—Henry David Thoreau (18171862)
“I can add colors to the chameleon,
Change shapes with Proteus for advantages,
And set the murderous Machiavel to school.”
—William Shakespeare (15641616)
“The butterflys attractiveness derives not only from colors and symmetry: deeper motives contribute to it. We would not think them so beautiful if they did not fly, or if they flew straight and briskly like bees, or if they stung, or above all if they did not enact the perturbing mystery of metamorphosis: the latter assumes in our eyes the value of a badly decoded message, a symbol, a sign.”
—Primo Levi (19191987)