forked from aafulei/color-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
how.cpp
44 lines (33 loc) · 961 Bytes
/
how.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()
{
auto a = dye::on_yellow(42);
cout << a << endl;
using vec = DoubleVector;
auto b = dye::red(vec{1, 2, 3});
b = b + dye::blue(vec{4, 5, 6});
b += dye::green(vec{7, 8, 9});
cout << b << endl;
cout << dye::on_white(string("strings")) + " are " +
dye::on_white("more") + string(" flexible") << endl;
cout << dye::colorize("grape", "purple") << endl;
cout << dye::invert(dye::red("red")) << endl;
auto contrast = dye::vanilla("contrast");
cout << contrast.invert() << endl;
return 0;
}