To set background colors you have to combine the foreground color code with the background color code using this equation.
How to use text color in dev c++. C Tutorial 5 - For loops and how to change text color - YouTube. But use colors in capital letters only. 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.
Colors must be written in all caps or expressed as a numeral. Use SetConsoleTextAttribute Method to Change Console Color in C SetConsoleTextAttribute is the Windows API method to set output text colors using different parameters. For exampleyou can write textcolorYELLOW.
You can use this function to vary the text colors of your output. Blue is 1 and white is 15. You will have to pass the name of the color or corresponding value which is shown in the table in the parameter of the function in which color you want to display the character on the screen or.
We can color both the background and text color in the output screen in the following ways. To reset everything back to the default colors you write 0330m. Include include main textcolorRED.
C Program for Printing number of Space 1 Not what you need. In order to make the text color red number 31 you can write 03331m which will make any following output red. Reach out to all the awesome people in our software development community by starting your own topic.
You can also use write appropriate color instead of integer. It is used to set the color of the character in Text Mode. Now if you want your text to blink then while calling the textcolor function pass the color and also say BLINK.