C textcolor()

The textcolor() function is defined in the conio.h header file. This function helps to change the colour of printed text.


void textcolor(int color);  #Where color is a integer variable


textcolor() Parameters: 

The textcolor() function takes a single parameter 'color' it is a integer variable which holds the corresponding integer value of a given colour.

Parameter Description Required / Optional
color it has a integer value Required

textcolor() Return Value

The textcolor() function does not return any value it just change the text colour.

Examples of textcolor()

Example 1: Working of textcolor() function in C?


#include <stdio.h>
#include <conio.h>

int main()  
{  
   // setting the color of text
 textcolor(GREEN);

 cprintf("Change the text colour to green");

 getch();
 return 0;
}  

Output:


Change the text colour to green /* with green textcolor */

Example 2: How textcolor() works in C?


#include <stdio.h>
#include <conio.h>
int main()  
{
   textcolor(BLUE+BLINK);
   cprintf("Making text with a blue blinking text");
   getch();
   return 0;
}

Output:

Making text with a blue blinking text /* with blue blinking */