The color values are as follows.
How to change text color in c++. C Tutorial 5 - For loops and how to change text colorWelcome to my simple tutorial on C. On windows try using conioh. Line 1 sets the foreground colour to yellow then outputs the prompt on line 3 in yellow.
All the 15 colors and their values are given in the table below. If You want to change the Text color in C language There are many ways. How to change text color in console apps using CC on Windows - YouTube.
Below is the table for allow color in C. For example 0 means BLACK color 1 means BLUE 2 means GREEN and soon. Use the textcolor function to define what color you want to use for text.
For exampleyou can write textcolorYELLOW. Using the colors you can make your program more attractive in C C. SystemColor XY In the above command to change the background color change the value X of the above syntax to the corresponding color you want and to change the text color change the value Y of the above syntax to the corresponding color you want.
For coloring every text variously you must first set textbackground and textcolor. This value is already defined in the compiler. To use the textbackground function all you need to do is before printing any text call this function with a parameter defining the color in capital letters.
Use SetConsoleTextAttribute Method to Change Console Color in C SetConsoleTextAttribute is the Windows API method to set output text colors using different parameters. You can use this function to vary the text colors of your output. F is the background color and g is the text color.