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.
Files changed (2) hide show
  1. package/index.js +218 -142
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1,147 +1,223 @@
1
1
  `use strict`
2
2
 
3
3
  const colors = {
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
- }
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
- 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) {this.store += colors['black'] + str + colors['reset']
62
- return this},
63
- r : function(str) {this.store += colors['red'] + str + colors['reset']
64
- return this},
65
- g : function(str) {this.store += colors['green'] + str + colors['reset']
66
- return this},
67
- y : function(str) {this.store += colors['yellow'] + str + colors['reset']
68
- return this},
69
- b : function(str) {this.store += colors['blue'] + str + colors['reset']
70
- return this},
71
- m : function(str) {this.store += colors['magenta'] + str + colors['reset']
72
- return this},
73
- c : function(str) {this.store += colors['cyan'] + str + colors['reset']
74
- return this},
75
- w : function(str) {this.store += colors['white'] + str + colors['reset']
76
- return this },
77
- //shorthand Foreground BRIGHT
78
- bk : function(str) {this.store += colors['bright_black'] + str + colors['reset']
79
- return this},
80
- br : function(str) {this.store += colors['bright_red'] + str + colors['reset']
81
- return this},
82
- bg : function(str) {this.store += colors['bright_green'] + str + colors['reset']
83
- return this},
84
- by : function(str) {this.store += colors['bright_yellow'] + str + colors['reset']
85
- return this},
86
- bb : function(str) {this.store += colors['bright_blue'] + str + colors['reset']
87
- return this},
88
- bm : function(str) {this.store += colors['bright_magenta'] + str + colors['reset']
89
- return this},
90
- bc : function(str) {this.store += colors['bright_cyan'] + str + colors['reset']
91
- return this},
92
- bw : function(str) {this.store += colors['bright_white'] + str + colors['reset']
93
- return this },
94
- //shorthand Background STANDARD
95
- K : function(str) {this.store += colors['bg_black']
96
- return this},
97
- R : function(str) {this.store += colors['bg_red']
98
- return this},
99
- G : function(str) {this.store += colors['bg_green']
100
- return this},
101
- Y : function(str) {this.store += colors['bg_yellow']
102
- return this},
103
- B : function(str) {this.store += colors['bg_blue']
104
- return this},
105
- M : function(str) {this.store += colors['bg_magenta']
106
- return this},
107
- C : function(str) {this.store += colors['bg_cyan']
108
- return this},
109
- W : function(str) {this.store += colors['bg_white']
110
- return this },
111
- //shorthand Background BRIGHT
112
- BB : function(str) {this.store += colors['bright_bg_black']
113
- return this},
114
- BR : function(str) {this.store += colors['bright_bg_red']
115
- return this},
116
- BG : function(str) {this.store += colors['bright_bg_green']
117
- return this},
118
- BY : function(str) {this.store += colors['bright_bg_yellow']
119
- return this},
120
- BB : function(str) {this.store += colors['bright_bg_blue']
121
- return this},
122
- BM : function(str) {this.store += colors['bright_bg_magenta']
123
- return this},
124
- BC : function(str) {this.store += colors['bright_bg_cyan']
125
- return this},
126
- BW : function(str) {this.store += colors['bright_bg_white']
127
- return this },
128
- //styles
129
- V : function() {this.store += colors['inverse']
130
- return this},
131
- _ : function() {this.store += colors['underline']
132
- return this},
133
- reset : function() {this.store += colors['reset']
134
- return this},
135
- I : function() {this.store += colors['intense']
136
- return this},
137
- blk : function() {this.store += colors['slow_blink']
138
- return this},
139
- rblk : function() {this.store += colors['rapid_blink']
140
- return this},
141
- end: function(){
142
- result = this.store
143
- //reset store
144
- this.store=''
145
- return result
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "8colors",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "chainable ansi 8 terminal colors",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,4 +34,4 @@
34
34
  "index.d.ts"
35
35
  ],
36
36
  "types": "index.d.ts"
37
- }
37
+ }