ANSI escape codes set the attributes and positioning of text in a terminal. A common use of these codes is to set the text color.
The code "\033[3xm"
sets the foreground color x
. These values are the decimal representation of a three-bit BGR color:
blue | green | red | binary | decimal (x) | color |
---|---|---|---|---|---|
0 | 0 | 0 | 000 | 0 | black |
0 | 0 | 1 | 001 | 1 | red |