C ++ console color modification

How to change the color of the console


First, I know so and so in some of the top search a bit console application to modify colors, but found a problem: not only those programs a lot , very complex , the most important is for beginners, simply can not read

Then we first look at some of the ways the Internet, said it! As the saying goes: "know, will know why!"
Here Insert Picture Description
This method is a relatively simple one, I am ready today speaking about this approach, but I see the friends explained, I suddenly dumbfounded ! I will not speak of anything else, there's DOS Some beginners do not know is doing, there is the following string of white absolutely do not understand the basis of a bunch of letters , but do not worry, I will today all the little white church, how to use a super-simple way to modify it to your likingConsole Color

First, we need to be clear how we change the color of the console, or the color of the console is divided into several parts

  • First, the console has four parts
  • First: is the first console window, which is the file name that a white (win10) or is that a transparent (win7)
  • Second: is the upper right corner of the console, which is what "Cha Cha" ah what
  • Third: cout is part of running the program, or part of printf, etc., that is, display some text or some other things on the console
  • Fourth: the console is the background to run the program, which is running the program, when that stuff cook Heibuliuqiu

Our idea is that what is it?

cmd命令
cmd命令
命令提示符
修改控制台的前景颜色
修改控制台的背景颜色
完成修改控制台前景和背景的颜色

We may still have some of this flow chart of strange, but do not worry, I will teach you hands modify the console color
first look at the program

#include <stdlib.h>
using namespace std;

int main()
{
	system("color F0");
	return 0;
}

If you can copy this code into your own program inside, then I congratulate you, you've put ablack and whiteThe modified into a consoleBlack and whiteConsole, but why not be able to see it at run time? This is not because you do not add delay , delay you want to know how to do, but also about after I made a delay off the console of the article, here to brief us on:In all compilers inside, either VS or DEV, first one must be an uppercase letter, the second must be a digit, the only way for the system to be able to modify the console is recognized by the color code! ! !

In fact, to be honest, this can be directly applied, the template is: System ( "Color plus letters and numbers")

Finally, the last, was with a reminder:When calling this command must be <stdlib.h> header file

Finally, the last of the last , I give you listed a set of data, then you can direct letters and numbers directly view the need to directly apply just fine, butRemember! Remember! Remember!It must be the first letter and should be capitalized , in the digital and Arabic numerals! ! !

Further, with a string of numbers and letters

0 = black, 1 = Blue, 2 = green, 3 = blue lake, 4 = red, purple = 5;

6 = Yellow, 7 = White, 8 = gray, light blue = 9, A = light green, B = light green;

C = pale red, D = lavender, E = yellowish, F = bright white.

For chestnut:
Here Insert Picture Description

Released five original articles · won praise 6 · views 113

Guess you like

Origin blog.csdn.net/dxfjdvsijdfhiv/article/details/104869934