Skip to content

textbackground

Thomas Foster edited this page Apr 15, 2021 · 2 revisions

Function   textbackground

Syntaxvoid textbackground(int newcolor);

Prototype in   conio.h

Return value   None.

See also gettextinfo, textattr, textcolor

Remarks

textbackground selects the background text color. The background color of all characters subsequently written by functions performing text mode, direct video output will be in the color given by newcolor, an integer from 0 to 7. You can give the color using one of the symbolic constants defined in conio.h. If you use these constants, you must include conio.h.

This function does not affect any characters currently on the screen, but only those displayed using direct console output (such as cprintf) after textbackground has been called.

The following table lists the allowable colors (as symbolic constants) and their numeric values:

Symbolic Constant Numeric Value
BLACK 0
BLUE 1
GREEN 2
CYAN 3
RED 4
MAGENTA 5
BROWN 6
LIGHTGRAY 7

Example

// makes a magenta background
textbackground(MAGENTA);

Header Files

Clone this wiki locally