8colors 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +218 -142
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,147 +1,223 @@
|
|
|
1
1
|
`use strict`
|
|
2
2
|
|
|
3
3
|
const colors = {
|
|
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
|
-
|
|
4
|
+
//style
|
|
5
|
+
"reset": "\033[0m",
|
|
6
|
+
"intense": "\033[1m",
|
|
7
|
+
"underline": "\033[4m",
|
|
8
|
+
"inverse": "\033[7m",
|
|
9
|
+
"slow_blink": "\033[5m",
|
|
10
|
+
"rapid_blink": "\033[6m",
|
|
11
|
+
// foreground colors STANDARD
|
|
12
|
+
"black": "\033[30m",
|
|
13
|
+
"red": "\033[31m",
|
|
14
|
+
"green": "\033[32m",
|
|
15
|
+
"yellow": "\033[33m",
|
|
16
|
+
"blue": "\033[34m",
|
|
17
|
+
"magenta": "\033[35m",
|
|
18
|
+
"cyan": "\033[36m",
|
|
19
|
+
"white": "\033[37m",
|
|
20
|
+
// foreground colors BRIGHT
|
|
21
|
+
"bright_black": "\033[90m",
|
|
22
|
+
"bright_red": "\033[91m",
|
|
23
|
+
"bright_green": "\033[92m",
|
|
24
|
+
"bright_yellow": "\033[93m",
|
|
25
|
+
"bright_blue": "\033[94m",
|
|
26
|
+
"bright_magenta": "\033[95m",
|
|
27
|
+
"bright_cyan": "\033[96m",
|
|
28
|
+
"bright_white": "\033[97m",
|
|
29
|
+
// background colors STANDARD
|
|
30
|
+
"bg_black": "\033[40m",
|
|
31
|
+
"bg_red": "\033[41m",
|
|
32
|
+
"bg_green": "\033[42m",
|
|
33
|
+
"bg_yellow": "\033[43m",
|
|
34
|
+
"bg_blue": "\033[44m",
|
|
35
|
+
"bg_magenta": "\033[45m",
|
|
36
|
+
"bg_cyan": "\033[46m",
|
|
37
|
+
"bg_white": "\033[47m",
|
|
38
|
+
// background colors BRIGHT
|
|
39
|
+
"bright_bg_black": "\033[100m",
|
|
40
|
+
"bright_bg_red": "\033[101m",
|
|
41
|
+
"bright_bg_green": "\033[102m",
|
|
42
|
+
"bright_bg_yellow": "\033[103m",
|
|
43
|
+
"bright_bg_blue": "\033[104m",
|
|
44
|
+
"bright_bg_magenta": "\033[105m",
|
|
45
|
+
"bright_bg_cyan": "\033[106m",
|
|
46
|
+
"bright_bg_white": "\033[107m"
|
|
47
|
+
}
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
module.exports =
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
50
|
+
module.exports = {
|
|
51
|
+
store: '',
|
|
52
|
+
black: function (str) { return colors['black'] + str + colors['reset'] },
|
|
53
|
+
red: function (str) { return colors['red'] + str + colors['reset'] },
|
|
54
|
+
green: function (str) { return colors['green'] + str + colors['reset'] },
|
|
55
|
+
yellow: function (str) { return colors['yellow'] + str + colors['reset'] },
|
|
56
|
+
blue: function (str) { return colors['blue'] + str + colors['reset'] },
|
|
57
|
+
magenta: function (str) { return colors['magenta'] + str + colors['reset'] },
|
|
58
|
+
cyan: function (str) { return colors['cyan'] + str + colors['reset'] },
|
|
59
|
+
white: function (str) { return colors['white'] + str + colors['reset'] },
|
|
60
|
+
//shorthand Foreground STANDARD
|
|
61
|
+
k: function (str) {
|
|
62
|
+
this.store += colors['black'] + str + colors['reset']
|
|
63
|
+
return this
|
|
64
|
+
},
|
|
65
|
+
r: function (str) {
|
|
66
|
+
this.store += colors['red'] + str + colors['reset']
|
|
67
|
+
return this
|
|
68
|
+
},
|
|
69
|
+
g: function (str) {
|
|
70
|
+
this.store += colors['green'] + str + colors['reset']
|
|
71
|
+
return this
|
|
72
|
+
},
|
|
73
|
+
y: function (str) {
|
|
74
|
+
this.store += colors['yellow'] + str + colors['reset']
|
|
75
|
+
return this
|
|
76
|
+
},
|
|
77
|
+
b: function (str) {
|
|
78
|
+
this.store += colors['blue'] + str + colors['reset']
|
|
79
|
+
return this
|
|
80
|
+
},
|
|
81
|
+
m: function (str) {
|
|
82
|
+
this.store += colors['magenta'] + str + colors['reset']
|
|
83
|
+
return this
|
|
84
|
+
},
|
|
85
|
+
c: function (str) {
|
|
86
|
+
this.store += colors['cyan'] + str + colors['reset']
|
|
87
|
+
return this
|
|
88
|
+
},
|
|
89
|
+
w: function (str) {
|
|
90
|
+
this.store += colors['white'] + str + colors['reset']
|
|
91
|
+
return this
|
|
92
|
+
},
|
|
93
|
+
//shorthand Foreground BRIGHT
|
|
94
|
+
bk: function (str) {
|
|
95
|
+
this.store += colors['bright_black'] + str + colors['reset']
|
|
96
|
+
return this
|
|
97
|
+
},
|
|
98
|
+
br: function (str) {
|
|
99
|
+
this.store += colors['bright_red'] + str + colors['reset']
|
|
100
|
+
return this
|
|
101
|
+
},
|
|
102
|
+
bg: function (str) {
|
|
103
|
+
this.store += colors['bright_green'] + str + colors['reset']
|
|
104
|
+
return this
|
|
105
|
+
},
|
|
106
|
+
by: function (str) {
|
|
107
|
+
this.store += colors['bright_yellow'] + str + colors['reset']
|
|
108
|
+
return this
|
|
109
|
+
},
|
|
110
|
+
bb: function (str) {
|
|
111
|
+
this.store += colors['bright_blue'] + str + colors['reset']
|
|
112
|
+
return this
|
|
113
|
+
},
|
|
114
|
+
bm: function (str) {
|
|
115
|
+
this.store += colors['bright_magenta'] + str + colors['reset']
|
|
116
|
+
return this
|
|
117
|
+
},
|
|
118
|
+
bc: function (str) {
|
|
119
|
+
this.store += colors['bright_cyan'] + str + colors['reset']
|
|
120
|
+
return this
|
|
121
|
+
},
|
|
122
|
+
bw: function (str) {
|
|
123
|
+
this.store += colors['bright_white'] + str + colors['reset']
|
|
124
|
+
return this
|
|
125
|
+
},
|
|
126
|
+
//shorthand Background STANDARD
|
|
127
|
+
K: function (str) {
|
|
128
|
+
this.store += colors['bg_black']
|
|
129
|
+
return this
|
|
130
|
+
},
|
|
131
|
+
R: function (str) {
|
|
132
|
+
this.store += colors['bg_red']
|
|
133
|
+
return this
|
|
134
|
+
},
|
|
135
|
+
G: function (str) {
|
|
136
|
+
this.store += colors['bg_green']
|
|
137
|
+
return this
|
|
138
|
+
},
|
|
139
|
+
Y: function (str) {
|
|
140
|
+
this.store += colors['bg_yellow']
|
|
141
|
+
return this
|
|
142
|
+
},
|
|
143
|
+
B: function (str) {
|
|
144
|
+
this.store += colors['bg_blue']
|
|
145
|
+
return this
|
|
146
|
+
},
|
|
147
|
+
M: function (str) {
|
|
148
|
+
this.store += colors['bg_magenta']
|
|
149
|
+
return this
|
|
150
|
+
},
|
|
151
|
+
C: function (str) {
|
|
152
|
+
this.store += colors['bg_cyan']
|
|
153
|
+
return this
|
|
154
|
+
},
|
|
155
|
+
W: function (str) {
|
|
156
|
+
this.store += colors['bg_white']
|
|
157
|
+
return this
|
|
158
|
+
},
|
|
159
|
+
//shorthand Background BRIGHT
|
|
160
|
+
BB: function (str) {
|
|
161
|
+
this.store += colors['bright_bg_black']
|
|
162
|
+
return this
|
|
163
|
+
},
|
|
164
|
+
BR: function (str) {
|
|
165
|
+
this.store += colors['bright_bg_red']
|
|
166
|
+
return this
|
|
167
|
+
},
|
|
168
|
+
BG: function (str) {
|
|
169
|
+
this.store += colors['bright_bg_green']
|
|
170
|
+
return this
|
|
171
|
+
},
|
|
172
|
+
BY: function (str) {
|
|
173
|
+
this.store += colors['bright_bg_yellow']
|
|
174
|
+
return this
|
|
175
|
+
},
|
|
176
|
+
BB: function (str) {
|
|
177
|
+
this.store += colors['bright_bg_blue']
|
|
178
|
+
return this
|
|
179
|
+
},
|
|
180
|
+
BM: function (str) {
|
|
181
|
+
this.store += colors['bright_bg_magenta']
|
|
182
|
+
return this
|
|
183
|
+
},
|
|
184
|
+
BC: function (str) {
|
|
185
|
+
this.store += colors['bright_bg_cyan']
|
|
186
|
+
return this
|
|
187
|
+
},
|
|
188
|
+
BW: function (str) {
|
|
189
|
+
this.store += colors['bright_bg_white']
|
|
190
|
+
return this
|
|
191
|
+
},
|
|
192
|
+
//styles
|
|
193
|
+
V: function () {
|
|
194
|
+
this.store += colors['inverse']
|
|
195
|
+
return this
|
|
196
|
+
},
|
|
197
|
+
_: function () {
|
|
198
|
+
this.store += colors['underline']
|
|
199
|
+
return this
|
|
200
|
+
},
|
|
201
|
+
reset: function () {
|
|
202
|
+
this.store += colors['reset']
|
|
203
|
+
return this
|
|
204
|
+
},
|
|
205
|
+
I: function () {
|
|
206
|
+
this.store += colors['intense']
|
|
207
|
+
return this
|
|
208
|
+
},
|
|
209
|
+
blk: function () {
|
|
210
|
+
this.store += colors['slow_blink']
|
|
211
|
+
return this
|
|
212
|
+
},
|
|
213
|
+
rblk: function () {
|
|
214
|
+
this.store += colors['rapid_blink']
|
|
215
|
+
return this
|
|
216
|
+
},
|
|
217
|
+
end: function () {
|
|
218
|
+
const result = this.store
|
|
219
|
+
//reset store
|
|
220
|
+
this.store = ''
|
|
221
|
+
return result
|
|
222
|
+
}
|
|
223
|
+
}
|
package/package.json
CHANGED