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:

    Thought maps existence; fantasy colors it.
    Mason Cooley (b. 1927)

    I can add colors to the chameleon,
    Change shapes with Proteus for advantages,
    And set the murderous Machiavel to school.
    William Shakespeare (1564–1616)

    [The Declaration of Independence] meant to set up a standard maxim for free society, which should be familiar to all, and revered by all; constantly looked to, constantly labored for, and even though never perfectly attained, constantly approximated, and thereby constantly spreading and deepening its influence, and augmenting the happiness and value of life to all people of all colors everywhere.
    Abraham Lincoln (1809–1865)