Depending on the graphics card installed and the video mode in effect, you can display 2, 4, 8, 16, or 256 colors on the screen at the same time. You specify a color by selecting a color index (sometimes called a “pixel value” or “color attribute”). The color indexes are numbered from 0 to n–1, where n is the number of colors in the palette.
CGA adapters offer four palettes containing predefined fixed color sets.
Summary: All video modes that support color offer a color palette.
EGA, MCGA, and VGA adapters have palettes that can be redefined to suit your needs. You can change the visible color associated with any color index by remapping to a color index a color value that describes the true color (the amount of red, green, and blue) you want to display.
Olivetti adapters (OCGA, OEGA, and OVGA) support the standard CGA, EGA, and VGA modes (and palettes), plus an additional Olivetti mode described in “Olivetti Palettes”.
Note:
The distinction between a color index and a color value is important. A color index is always a short integer. A color value is always a long integer. The only exception to this rule involves _setbkcolor, which uses a color index cast to a long integer in CGA and text modes.