1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
enum Color_t {Gray, White ,DarkRed,Red,DarkBlue, Blue, DarkGreen,Green,DarkCyan,Cyan,DarkMagenta,Magenta,DarkYellow,Yellow, None};
HANDLE Global::hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
void SetColor(Color_t Fore)
{
WORD fore;
switch(Fore)
{
case 0:
fore = FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN;
break;
case 1:
fore = FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_INTENSITY;
break;
case 2:
fore = FOREGROUND_RED;
break;
case 3:
fore = FOREGROUND_RED|FOREGROUND_INTENSITY;
break;
case 4:
fore = FOREGROUND_BLUE;
break;
case 5:
fore = FOREGROUND_BLUE|FOREGROUND_INTENSITY;
break;
case 6:
fore = FOREGROUND_GREEN;
break;
case 7:
fore = FOREGROUND_GREEN|FOREGROUND_INTENSITY;
break;
case 8:
fore = FOREGROUND_BLUE|FOREGROUND_GREEN;
break;
case 9:
fore = FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_INTENSITY;
break;
case 10:
fore = FOREGROUND_BLUE|FOREGROUND_RED;
break;
case 11:
fore = FOREGROUND_BLUE|FOREGROUND_RED|FOREGROUND_INTENSITY;
break;
case 12:
fore = FOREGROUND_RED|FOREGROUND_GREEN;
break;
case 13:
fore = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY;
break;
}
SetConsoleTextAttribute(Global::hStdout,fore);
}
|