In Graphics each color is assigned a numberTotal number of colors available are 16.
How to use text color in c++. Void coutcint color char output HANDLE handle GetStdHandleSTD_OUTPUT_HANDLE. For the end user the command line utility tput can access these sequences by name. Number of available colors.
You could type 4. Colour isnt a C thing but a property of your terminal. A simple way to change text color to blue is to include this statement within the main.
You can use this function to vary the text colors of your output. I only want to colorize the days in Sunday. Here are some more examples.
Give this a shot as you can see systemColor 1A changes the color. Color your text in Windows console mode colors are 0black 1blue 2green and so on to 15white colorattribute foreground background 16 to get red text on yellow use 4 1416 228 light red on yellow would be 12 1416 236 FlushConsoleInputBufferhConsole. To change text color to YELLOW.
Text colors and styles are not in the standard yet AFAIK but you can get them with the version from github where you can find this example. Use fmt library which is being slowly absorbed into C standard starting with C20 in header. Where color is an integer variable.
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 print it. Any Linux terminal or DOS or Windows NT if you add DEVICECDOSansisys to your configsys or later Windows if you call the shell with cmdexe kansicon then you can try the following gimmick. Where x is the background color y is the text color.