Skip to content

textcolor

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

Function   Selects new character color in text mode.

Syntaxvoid textcolor(int newcolor);

Prototype in   conio.h

Return value   None.

See also gettextinfo, highvideo, lowvideo, normvideo, textattr, textbackground

Remarks

textcolor selects the foreground character color. The foreground color of all characters subsequently written by console output functions will be the color given by newcolor. You can give the color using a symbolic constant defined in conio.h. If you use the 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 textcolor has been called.

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

(TABLE)

You can make the characters blink by adding 128 to the foreground color. The predefined constant BLINK exists for this purpose. For example,

textcolor(CYAN + BLINK);

Header Files

Clone this wiki locally