textbackground
Selects new text background color.
Defined in header <conio.h>
Syntax
#include <conio.h>
void textbackgroimdCint newcolor);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
textbackground selects the background color. This function works for functions that produce output in text mode directly to the screen, nezvcolor selects the new background color. You can set nezvcolor to an integer from 0 to 7, or to one of the symbolic constants defined in conio.h. If you use symbolic constants, you must include conio.h.
Once you have called textbackground, all subsequent functions using direct video output (such as cprintf) will use nezvcolor. textbackground does not affect any characters currently onscreen.
The following table lists the symbolic constants and the numeric values of the allowable colors:
| Symbolic constant | Numeric value |
| BLACK | 0 |
| BLUE | 1 |
| GREEN | 2 |
| CYAN | 3 |
| RED | 4 |
| MAGENTA | 5 |
| BROWN | 6 |
| LIGHTGRAY | 7 |
Return value
None.
See also
Example
include <conio.h>
int main(void)
{
int i, j;
clrscrO ;
for (i=0; i<9; i++) {
for (]=0; j<80; j++)
cprintf ("C"),•
cprintf ("\r\n");
textcolor (i+1);
textbackground (i);
,}
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/conio.h/textbackground/
· short form /3.1/textbackground/