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
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 |
The textcolor() function does not return any value it just change the text colour.
#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 */
#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 */