How Add Background and Font color in C, C++ Outputs?



I always wish to add some good user interface in my C,C++ code, but basically, its a lengthy process. But, actually that black and white CMD screen is a bit boring, so here is a way to get rid of it.

To add colors in your CMD, you just have to add one command in your program, here it is:
system("color 9F");

Thats it. after adding this, the background colour will turn to blue, and the font color will turn to bright white.
Note that here, 9 i.e. the first hexa code indicates the background color and F indicates font color.

Here are color values with color:

    0 = Black       8 = Gray
    1 = Blue        9 = Light Blue
    2 = Green       A = Light Green
    3 = Aqua        B = Light Aqua
    4 = Red         C = Light Red
    5 = Purple      D = Light Purple
    6 = Yellow      E = Light Yellow
    7 = White       F = Bright White

Must try this trick in your program. You try and change different color after different activities of your program, so it will keep changing repeatedly.




See you next time();

Related Posts with How Add Background and Font color in C, C++ Outputs?