30 black foreground
31 red foreground
32 green foreground
33 brown foreground
34 blue foreground
35 magenta (purple) foreground
36 cyan (light blue) foreground
37 gray foreground
40 black background
41 red background
42 green background
43 brown background
44 blue background
45 magenta background
46 cyan background
47 white background
Commands can also be combined using a semicolon, like so:
printf
(
"\033[45;37mGrey on purple.\033[0m"
);
Finally here is a list of other neat commands that go at the end (where the '0' is):
0 reset all attributes to their defaults
1 set bold
5 set blink
7 set reverse video
22 set normal intensity
25 blink off
27 reverse video off
=====================================================
Another one:
\033[22;30m - black
\033[22;31m - red
\033[22;32m - green
\033[22;33m - brown
\033[22;34m - blue
\033[22;35m - magenta
\033[22;36m - cyan
\033[22;37m - gray
\033[01;30m - dark gray
\033[01;31m - light red
\033[01;32m - light green
\033[01;33m - yellow
\033[01;34m - light blue
\033[01;35m - light magenta
\033[01;36m - light cyan
\033[01;37m - white