-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.cpp
74 lines (68 loc) · 2.34 KB
/
demo.cpp
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <string>
#include <vector>
#include <iostream>
#include "include/color.h"
namespace cF = color::Foreground;
namespace bF = color::Background;
int main() {
// Heading
std::string header = "\n\t\t\t*** Color Cpp Demo ***\n";
std::cout << color::Colored(header, color::YELLOW, color::BOLD, color::UNDERLINE) << std::endl;
// Foreground colors
const std::string foreground_text = "\tColored Text";
const std::vector<std::string> foreground_colors {
cF::BLACK,
cF::DARK_RED,
cF::DARK_GREEN,
cF::DARK_YELLOW,
cF::DARK_BLUE,
cF::DARK_MAGENTA,
cF::DARK_CYAN,
cF::DARK_WHITE,
cF::LIGHT_BLACK,
cF::LIGHT_RED,
cF::LIGHT_GREEN,
cF::LIGHT_YELLOW,
cF::LIGHT_BLUE,
cF::LIGHT_MAGENTA,
cF::LIGHT_CYAN,
cF::WHITE
};
std::cout << color::Colored("\tDark Foreground", color::UNDERLINE) << "\t\t" <<
color::Colored("\tLight Foreground", color::UNDERLINE) << "\n" << std::endl;
size_t fSize = (size_t)foreground_colors.size()/2;
for (size_t i=0; i < fSize; i++) {
std::cout << color::Colored(foreground_text, foreground_colors[i]) << "\t\t";
std::cout << color::Colored(foreground_text, foreground_colors[i+fSize]) << std::endl;
}
std::cout << std::endl;
// Background colors
const std::string background_text = "\tColored Background";
const std::vector<std::string> background_colors {
bF::BLACK,
bF::DARK_RED,
bF::DARK_GREEN,
bF::DARK_YELLOW,
bF::DARK_BLUE,
bF::DARK_MAGENTA,
bF::DARK_CYAN,
bF::DARK_WHITE,
bF::LIGHT_BLACK,
bF::LIGHT_RED,
bF::LIGHT_GREEN,
bF::LIGHT_YELLOW,
bF::LIGHT_BLUE,
bF::LIGHT_MAGENTA,
bF::LIGHT_CYAN,
bF::WHITE
};
std::cout << color::Colored("\tDark Background", color::UNDERLINE) << "\t\t" <<
color::Colored("\tLight Background", color::UNDERLINE) << "\n" << std::endl;
size_t bSize = (size_t)background_colors.size()/2;
for (size_t i=0; i < bSize; i++) {
std::cout << color::Colored(background_text, background_colors[i]) << "\t";
std::cout << color::Colored(background_text, background_colors[i+bSize]) << std::endl;
}
std::cout << "\n" << std::endl;
return 0;
}