number and name | blue | green | red |
---|---|---|---|
0 black | 0 | 0 | 0 |
1 red | 0 | 0 | 1 |
2 green | 0 | 1 | 0 |
3 yellow | 0 | 1 | 1 |
4 blue | 1 | 0 | 0 |
5 magenta | 1 | 0 | 1 |
6 cyan | 1 | 1 | 0 |
7 white | 1 | 1 | 1 |
terminal escape codes: "ESC[3n;m
",
where ESC is byte \033=0x1B=^[,
n is the colour number from above,
and the "[3" and "m" are a literal opening-square-bracket, three, and m.
reset with ESC[0m.
use 4 instead of 3 for background colours,
and in some terminals, 9 and 10 for bright foreground or background.
use the colour number "9" for the terminal default, in case it differs
from all of the other defined colours.
insert more graphical controls at once into a single escape code
by separating the numbers with a semicolon before terminating
the whole sequence with the m.
posted 2018-01-30 | index