RAD Studio
ContentsIndex
PreviousUpNext
textcolor

Header File 

conio.h  

Category 

Console I/O Routines 

Prototype 

void textcolor(int newcolor); 

Description 

Selects new character color in text mode.

Note: Do not use this function in Win32 GUI applications.
textcolor selects the foreground character color. This function works for the console output functions. newcolor selects the new foreground color. You can set newcolor to an integer as given in the table below, 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 textcolor, all subsequent functions using direct video output (such as cprintf) will use newcolor. textcolor does not affect any characters currently onscreen. 

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

BLACK 
BLUE 
GREEN 
CYAN 
RED 
MAGENTA 
BROWN 
LIGHTGRAY 
DARKGRAY 
LIGHTBLUE 
LIGHTGREEN 
10 
LIGHTCYAN 
11 
LIGHTRED 
12 
LIGHTMAGENTA 
13 
YELLOW 
14 
WHITE 
15 
BLINK 
128 

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);

Note: Some monitors do not recognize the intensity signal used to create the eight “light” colors (8-15). On such monitors, the light colors are displayed as their “dark” equivalents (0-7). Also, systems that do not display in color can treat these numbers as shades of one color, special patterns, or special attributes (such as underlined, bold, italics, and so on). Exactly what you’ll see on such systems depends on your hardware.
Return Value 

None. 

Portability  

POSIX 
Win32 
ANSI C 
ANSI C++ 
 
 
 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!