You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thomas Foster edited this page Apr 15, 2021
·
2 revisions
Function Selects new text background color
Syntaxvoid textbackground(int newcolor);
Prototype in conio.h
Return value None.
See alsogettextinfo, 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 backgroundtextbackground(MAGENTA);