Changing Colors

The functions below control colors and color palettes. For an introduction to this topic, see “Mixing Colors and Changing Palettes”. For function prototypes and more information, consult Help.

_getbkcolor

Reports the current background color as a long integer. In EGA, MCGA, and VGA video modes, this is a color value. In CGA and text modes, it is a color index.

_getcolor

Returns the current color index.

_remapallpalette

Assigns new color values to all color indexes. Pass a pointer to an array of color values. Returns 0 if unsuccessful.

_remappalette

Assigns a color value to a specific color index. Pass a short color index and a long color value (which specifies the amount of red, green, and blue). Returns the previous color value for that index or –1 if unsuccessful. See “CGA Palettes”.

_selectpalette

Selects a predefined palette. This function applies only to the CGA video modes _MRES4COLOR and _MRESNOCOLOR and the Olivetti graphics mode _ORESCOLOR. To change palettes in other color video modes, use _remappalette instead. Pass a short integer in the range 0–4 for CGA, or 0–15 for Olivetti mode. Returns the value of the previous palette.

_setbkcolor

Sets the current background color. Always pass a long integer. In EGA, MCGA, and VGA modes, this value is a color value. In CGA and text modes, this is a color index cast to a long integer. Returns the old background color or –1 if unsuccessful.

_setcolor

Sets the color index to be used for graphic output. It affects later calls to functions such as _arc, _ellipse, _floodfill, _lineto, _outgtext, _outtext, _pie, _rectangle, and _setpixel. Returns the previous color or –1 if unsuccessful.