forked from aafulei/color-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhy.cpp
44 lines (33 loc) · 1.1 KB
/
why.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
#include "../include/color.hpp"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct DoubleVector : private vector<double>
{
using vector<double>::vector;
friend ostream & operator<<(ostream &, const DoubleVector &);
};
ostream & operator<<(ostream & os, const DoubleVector & v)
{
for (const auto & e : v)
os << e << " ";
return os;
}
int main()
{
cout << "When in doubt, wear " << dye::red("red") << "." << endl;
auto green = dye::green("green");
cout << "I saw "<< green << " trees, " << green << " bushes." << endl;
cout << "Take the " << dye::blue("Blue") << " Line and then "
<< "catch Bus " << dye::yellow(42 + 7 % 8) << "."<< endl;
cout << dye::purple(DoubleVector{3.14, 2.72}) << endl;
cout << dye::light_red('A') + dye::light_blue('B')
+ dye::light_green('C') << endl;
const char ca[] = "ca";
string str = "str";
cout << "[ " + dye::aqua(ca) + " | " + dye::aqua(str) + " ]" << endl;
double a = 88.88;
cout << dye::colorize(a, a >= 0 ? "red" : "green").invert() << endl;
return 0;
}