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:
“Few colors last; with their eternal thirst, time and light suck on them, and they bleach the black doctors hat until its grey like a dunces cap.”
—Franz Grillparzer (17911872)
“Painting myself for others, I have painted my inward self with colors clearer than my original ones. I have no more made my book than my book has made mea book consubstantial with its author, concerned with my own self, an integral part of my life; not concerned with some third-hand, extraneous purpose, like all other books.”
—Michel de Montaigne (15331592)
“Our frigate takes fire,
The other asks if we demand quarter?
If our colors are struck and the fighting done?
Now I laugh content for I hear the voice of my little captain,
We have not struck, he composedly cries, we have just begun our part of the fighting.”
—Walt Whitman (18191892)