Loading...
Searching...
No Matches
colormod.H
Go to the documentation of this file.
1#include <ostream>
2
5
6#ifndef colormod_H
7#define colormod_H
8
9namespace Color
10{
11enum Code
12{
13 FG_RED = 31,
15 FG_BLUE = 34,
17 BG_RED = 41,
19 BG_BLUE = 44,
20 BG_DEFAULT = 49
21};
24{
25 Code code;
26 public:
27 Modifier(Code pCode) : code(pCode) {}
28 friend std::ostream&
29 operator<<(std::ostream& os, const Modifier& mod)
30 {
31 return os << "\033[" << mod.code << "m";
32 }
33};
34}
35
36#endif
Class to change color to the output stream.
Definition colormod.H:24
Modifier(Code pCode)
Definition colormod.H:27
friend std::ostream & operator<<(std::ostream &os, const Modifier &mod)
Definition colormod.H:29
@ BG_BLUE
Definition colormod.H:19
@ BG_DEFAULT
Definition colormod.H:20
@ FG_GREEN
Definition colormod.H:14
@ BG_GREEN
Definition colormod.H:18
@ FG_DEFAULT
Definition colormod.H:16
@ FG_BLUE
Definition colormod.H:15
@ BG_RED
Definition colormod.H:17
@ FG_RED
Definition colormod.H:13