CGA Palettes

The CGA (Color Graphics Adapter) supports two color video modes, _MRES4COLOR and _MRESNOCOLOR, which display four colors selected from one of several predefined palettes of colors. They display these foreground colors against a background color that can be any one of the 16 available colors. With the CGA hardware, the palette of foreground colors is predefined and cannot be changed. Each palette number is an integer. (See Table 9.4.)

Table 9.4 CGA Palettes in _MRES4COLOR Mode

    Color Index,  

Palette Number 1 2 3

0 Green Red Brown
1 Cyan Magenta Light Gray
2 Light Green Light Red Yellow
3 Light Cyan Light Magenta White

Summary: _MRESNOCOLOR produces palettes with shades of gray on monochrome monitors.

The _MRESNOCOLOR video mode produces palettes containing various shades of gray on monochrome monitors. However, the _MRESNOCOLOR mode displays colors when used with a color display. Only two palettes are available in this mode. Table 9.5 shows the colors available in the two palettes.

Table 9.5 CGA Palettes in _MRESNOCOLOR Mode

    Color Index,  

Palette Number 1 2 3

0 Blue Red Light Gray
1 Light Blue Light Red White

You can use the _selectpalette function only in the _MRES4COLOR, _MRESNOCOLOR, and _ORESCOLOR graphics modes. To change palettes in other video modes, use the _remappalette or _remapallpalette functions.