-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColor.hpp
More file actions
34 lines (27 loc) · 721 Bytes
/
Color.hpp
File metadata and controls
34 lines (27 loc) · 721 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
#pragma once
#include <string>
class Color
{
std::string code;
Color(std::string const& code);
public:
friend std::string operator|(std::string const& str, Color const& c);
friend std::ostream& operator<<(std::ostream& out, Color const& c);
static Color const RESET;
static Color const RED;
static Color const GREEN;
static Color const BLUE;
static Color const PURPLE;
static Color const CYAN;
static Color const BOLD;
static Color const UNDERLINED;
static Color const ITALIC;
};
inline std::string operator|(std::string const& str, Color const& c)
{
return c.code + str + c.RESET.code;
}
inline std::ostream& operator<<(std::ostream& out, Color const& c)
{
return out << c.code;
}