echo -e "testing \033[48;5;88mCOLOR1\033[38;208;48;5;159mCOLOR2\033[m"
The color range of a 256 color terminal consists of 4 parts, often 5, in which case you actually get 258 colors:
- Color numbers 0 to 7 are the default terminal colors, the actual RGB value of which is not standardized and can often be configured.
- Color numbers 8 to 15 are the "bright" colors. Most of the time these are a lighter shade of the color with index - 8. They are also not standardized and can often be configured. Depending on terminal and shell, they are often used instead of or in conjunction with bold font faces.
- Color numbers 16 to 231 are RGB colors. These 216 colors are defined by 6 values on each of the three RGB axes. That is, instead of values 0 - 255, each color only ranges from 0 - 5.
The color number is then calculated like this:
number = 16 + 36 * r + 6 * g + b
with r, g and b in the range 0 - 5.
The color numbers 232 to 255 are grayscale with 24 shades of gray from dark to light.
The default colors for foreground and background. In many terminals they can be configured independently from the 256 indexed colors, giving an additional two configurable colors . You get them when not setting any other color or disabling other colors