ANSI Escape Code - Colors

Colors

Text color is manipulated using CSI n m sequence.

Color table
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 Quoting

Read 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 (1817–1862)

    Nature always wears the colors of the spirit. To a man laboring under calamity, the heat of his own fire hath sadness in it.
    Ralph Waldo Emerson (1803–1882)

    Language as a real thing is not imitation either of sounds or colors or emotions it is an intellectual recreation and there is no possible doubt about it and it is going to go on being that as long as humanity is anything.
    Gertrude Stein (1874–1946)