-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.cpp
53 lines (41 loc) · 1.93 KB
/
example.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
#include <stdio.h>
#include <string>
#include "chalk.h"
using namespace chalk;
int main(int argc, char* argv[])
{
std::string str = "\n ";
// User defined literals for formatting
str += "Formatting"_u + "\n ";
str += "regular " + "bold "_bold + "dim "_dim + "italic "_i;
str += "underline"_u + " " + "double"_uu + " " + Overlined("overline") + "\n ";
str += "inverse"_inverse + " blink "_blink + "strikethrough"_strike + " " + " conceal"_conceal + "\n\n";
// Colors
str += " " + "Colors\n"_u;
auto colors = " black "_black + "red "_red + "green "_green
+ "yellow "_yellow + "blue "_blue + "magenta "_magenta
+ "cyan "_cyan + "white"_white + " gray"_gray "\n";
str += colors;
// Background colors
auto bgColors = Conceal(" " + Black.bg("black") + " " + Red.bg("red") + " " + Green.bg("green")
+ " " + Yellow.bg("yellow") + " " + Blue.bg("blue") + " " + Magenta.bg("magenta")
+ " " + Cyan.bg("cyan") + " " + White.bg("white") + " " + Gray.bg("gray") + "\n");
str += bgColors;
// Bright colors
str += "\n " + "Bright Colors\n"_u;
str += Black.bright(" black ") + Red.bright("red ") + Green.bright("green ")
+ Yellow.bright("yellow ") + Blue.bright("blue ") + Magenta.bright("magenta ")
+ Cyan.bright("cyan ") + White.bright("white ") + Gray.bright("gray") + "\n";
// Bright background colors
str += Hide(" " + Black.bgBright("black") + " " + Red.bgBright("red") + " " + Green.bgBright("green")
+ " " + Yellow.bgBright("yellow") + " " + Blue.bgBright("blue") + " " + Magenta.bgBright("magenta")
+ " " + Cyan.bgBright("cyan") + " " + White.bgBright("white") + " " + Gray.bgBright("gray")) + "\n";
// Dim colors
str += "\n " + "Dim Colors\n"_u;
str += Dim(colors);
str += Dim(bgColors);
// Reset
str += Reset;
puts(str.c_str());
return 0;
}