_setbkcolor

Description

Sets the current background color.

#include <graph.h>

long __far _setbkcolor( long color );

color Desired color  

Remarks

The _setbkcolor function sets the current background color to the color value color.

In a color text mode (such as _TEXTC80), _setbkcolor accepts (and
_getbkcolor returns) a color index. The value for the default colors is given
in a table in the description of the _settextcolor function. For example,
_setbkcolor(2L)
sets the background color to color index 2. The actual color displayed depends on the palette mapping for color index 2. The default is green in a color text mode.

In a color graphics mode (such as _ERESCOLOR), _setbkcolor accepts (and _getbkcolor returns) a color value. The value for the background color is given by the manifest constants defined in the GRAPH.H include file. For example, _setbkcolor(_GREEN) sets the background color in a graphics mode to green. These manifest constants are provided as a convenience in defining and manipulating the most common colors. The actual range of colors is, in general, much greater.

In general, whenever a color argument is long, it refers to a color value, and whenever it is short, it refers to a color index. The two exceptions are _setbkcolor and _getbkcolor.

Since the background color is color index 0, the _remappalette function will act identically to the _setbkcolor function. Unlike _remappalette, however, _setbkcolor does not require an EGA or VGA environment.

In a text mode, the _setbkcolor function does not affect anything already appearing on the display; only the subsequent output is affected. In a graphics mode, it immediately changes all background pixels.

Return Value

In text modes, _setbkcolor returns the color index of the old background color. In graphics modes, _setbkcolor returns the old color value of color index 0. There is no error return. Use the _grstatus function to check the status after a call to _setbkcolor.

Compatibility

Standards:None

16-Bit:DOS

32-Bit:None

See Also

_getbkcolor, _grstatus, _remappalette, _selectpalette

Example

See the example for _getcolor.