-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathchalk.js
125 lines (115 loc) · 3.71 KB
/
chalk.js
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
'use strict';
module.exports = class Chalk {
constructor() {
this.waringCount = 0
this.errorCount = 0
this.infoCount = 0
this._die = {
Reset: "\x1b[0m",
Bright: "\x1b[1m",
Dim: "\x1b[2m",
Underscore: "\x1b[4m",
Blink: "\x1b[5m",
Reverse: "\x1b[7m",
Hidden: "\x1b[8m",
FgBlack: "\x1b[30m",
FgRed: "\x1b[31m",
FgGreen: "\x1b[32m",
FgYellow: "\x1b[33m",
FgBlue: "\x1b[34m",
FgMagenta: "\x1b[35m",
FgCyan: "\x1b[36m",
FgWhite: "\x1b[37m",
FgLightBlack: "\x1b[90m",
FgLightRed: "\x1b[91m",
FgLightGreen: "\x1b[92m",
FgLightYellow: "\x1b[93m",
FgLightBlue: "\x1b[94m",
FgLightMagenta: "\x1b[95m",
FgLightCyan: "\x1b[96m",
FgLightWhite: "\x1b[97m",
BgBlack: "\x1b[40m",
BgRed: "\x1b[41m",
BgGreen: "\x1b[42m",
BgYellow: "\x1b[43m",
BgBlue: "\x1b[44m",
BgMagenta: "\x1b[45m",
BgCyan: "\x1b[46m",
BgWhite: "\x1b[47m",
BgLightBlack: "\x1b[100m",
BgLightRed: "\x1b[101m",
BgLightGreen: "\x1b[102m",
BgLightYellow: "\x1b[103m",
BgLightBlue: "\x1b[104m",
BgLightMagenta: "\x1b[105m",
BgLightCyan: "\x1b[106m",
BgLightWhite: "\x1b[107m",
}
}
red(string) {
return this._die.FgRed + string + this._die.Reset;
}
lightRed(string) {
return this._die.FgLightRed + string + this._die.Reset;
}
green(string) {
return this._die.FgGreen + string + this._die.Reset;
}
lightGreen(string) {
return this._die.FgLightGreen + string + this._die.Reset;
}
blue(string) {
return this._die.FgBlue + string + this._die.Reset;
}
lightBlue(string) {
return this._die.FgLightBlue + string + this._die.Reset;
}
yellow(string) {
return this._die.FgYellow + string + this._die.Reset;
}
lightYellow(string) {
return this._die.FgLightYellow + string + this._die.Reset;
}
cyan(string) {
return this._die.FgCyan + string + this._die.Reset;
}
lightCyan(string) {
return this._die.FgLightCyan + string + this._die.Reset;
}
magenta(string) {
return this._die.FgMagenta + string + this._die.Reset;
}
lightMagenta(string) {
return this._die.FgLightMagenta + string + this._die.Reset;
}
white(string) {
return string;
}
warn(string) {
this.waringCount++;
return '(' + this.lightYellow('Warning') + ') [' + this.green(this.waringCount) + '] '+this.lightBlue(Date()) + this._die.Reset + "\t: " + this.lightYellow(string);
}
error(string) {
this.errorCount++;
return '(' + this.lightRed('Error') + ') [' + this.yellow(this.errorCount) + '] ' +this.lightBlue(Date()) + this._die.Reset + "\t: "+ this.lightRed(string);
}
info(string) {
this.infoCount++;
return '(' + this.lightGreen('Info') + ') [' + this.yellow(this.infoCount) + '] '+this.lightBlue(Date()) + this._die.Reset + "\t: " + this.green(string);
}
invertBg(string) {
return this._die.Reverse + string + this._die.Reset;
}
blink(string) {
return this._die.Blink + string + this._die.Reset;
}
dim(string) {
return this._die.Dim + string + this._die.Reset;
}
underscore(string) {
return this._die.Underscore + string + this._die.Reset;
}
bright(string) {
return this._die.Bright + string + this._die.Reset;
}
}