-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsoleColor.h
More file actions
36 lines (30 loc) · 791 Bytes
/
ConsoleColor.h
File metadata and controls
36 lines (30 loc) · 791 Bytes
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
/*
* ConsoleColor.h
*
* Created on: Nov 17, 2006
* Copyleft: Vincent Godin
*
* Modified on: Nov 26, 2008
* By: Dzuka Automat
*
* Source: http://www.codeproject.com/KB/cpp/cout_color.aspx
*/
#ifndef CONSOLECOLOR_H_
#define CONSOLECOLOR_H_
#include <iostream>
#include <windows.h>
enum color
{
red = FOREGROUND_RED | FOREGROUND_INTENSITY,
green = FOREGROUND_GREEN | FOREGROUND_INTENSITY,
blue = FOREGROUND_BLUE | FOREGROUND_INTENSITY,
yellow = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY,
white = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
};
inline std::ostream& operator<< (std::ostream& s, const color& c)
{
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdout, c);
return s;
}
#endif /* CONSOLECOLOR_H_ */