@contrast/agent 4.16.2 → 4.18.0
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/esm.mjs +21 -11
- package/lib/assess/policy/propagators.json +4 -0
- package/lib/assess/policy/signatures.json +5 -0
- package/lib/assess/propagators/fastify-static/allowed-path.js +85 -0
- package/lib/assess/sources/index.js +26 -5
- package/lib/cli-rewriter/index.js +1 -1
- package/lib/contrast.js +1 -1
- package/lib/core/config/options.js +14 -1
- package/lib/core/config/util.js +39 -11
- package/lib/core/rewrite/index.js +2 -2
- package/lib/protect/service.js +2 -0
- package/lib/util/trace-util.js +5 -4
- package/node_modules/@colors/colors/LICENSE +26 -0
- package/node_modules/@colors/colors/README.md +219 -0
- package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
- package/node_modules/@colors/colors/examples/safe-string.js +80 -0
- package/node_modules/@colors/colors/index.d.ts +136 -0
- package/node_modules/@colors/colors/lib/colors.js +211 -0
- package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
- package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
- package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
- package/node_modules/@colors/colors/lib/index.js +13 -0
- package/node_modules/@colors/colors/lib/maps/america.js +10 -0
- package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
- package/node_modules/@colors/colors/lib/maps/random.js +11 -0
- package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
- package/node_modules/@colors/colors/lib/styles.js +95 -0
- package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
- package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
- package/node_modules/@colors/colors/package.json +49 -0
- package/node_modules/@colors/colors/safe.d.ts +48 -0
- package/node_modules/@colors/colors/safe.js +10 -0
- package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
- package/node_modules/@dabh/diagnostics/README.md +16 -16
- package/node_modules/@dabh/diagnostics/package.json +9 -9
- package/node_modules/color/README.md +9 -0
- package/node_modules/color/index.js +4 -1
- package/node_modules/color/package.json +8 -8
- package/node_modules/color-string/README.md +6 -2
- package/node_modules/color-string/index.js +21 -13
- package/node_modules/color-string/package.json +4 -4
- package/node_modules/colorspace/package.json +5 -5
- package/node_modules/fecha/dist/fecha.min.js +1 -1
- package/node_modules/fecha/dist/fecha.min.js.map +1 -0
- package/node_modules/fecha/lib/fecha.d.ts +2 -2
- package/node_modules/fecha/lib/fecha.js +35 -18
- package/node_modules/fecha/lib/fecha.js.map +1 -0
- package/node_modules/fecha/lib/fecha.umd.js +35 -18
- package/node_modules/fecha/lib/fecha.umd.js.map +1 -0
- package/node_modules/fecha/package.json +9 -10
- package/node_modules/fecha/src/fecha.ts +524 -0
- package/node_modules/logform/.eslintrc +1 -1
- package/node_modules/logform/CHANGELOG.md +24 -0
- package/node_modules/logform/README.md +15 -17
- package/node_modules/logform/browser.js +3 -1
- package/node_modules/logform/cli.js +1 -1
- package/node_modules/logform/colorize.js +2 -2
- package/node_modules/logform/dist/browser.js +8 -2
- package/node_modules/logform/dist/cli.js +2 -2
- package/node_modules/logform/dist/colorize.js +5 -5
- package/node_modules/logform/dist/errors.js +1 -1
- package/node_modules/logform/dist/format.js +9 -5
- package/node_modules/logform/dist/index.js +53 -20
- package/node_modules/logform/dist/json.js +7 -6
- package/node_modules/logform/dist/logstash.js +1 -1
- package/node_modules/logform/dist/pad-levels.js +4 -4
- package/node_modules/logform/dist/printf.js +1 -1
- package/node_modules/logform/dist/simple.js +1 -1
- package/node_modules/logform/dist/splat.js +2 -2
- package/node_modules/logform/dist/uncolorize.js +1 -1
- package/node_modules/logform/errors.js +1 -1
- package/node_modules/logform/index.d.ts +36 -0
- package/node_modules/logform/index.js +19 -20
- package/node_modules/logform/json.js +7 -7
- package/node_modules/logform/logstash.js +1 -1
- package/node_modules/logform/package.json +10 -9
- package/node_modules/logform/simple.js +1 -1
- package/node_modules/logform/uncolorize.js +1 -1
- package/node_modules/safe-stable-stringify/CHANGELOG.md +75 -0
- package/node_modules/safe-stable-stringify/LICENSE +21 -0
- package/node_modules/safe-stable-stringify/esm/package.json +4 -0
- package/node_modules/safe-stable-stringify/esm/wrapper.js +6 -0
- package/node_modules/safe-stable-stringify/index.d.ts +18 -0
- package/node_modules/safe-stable-stringify/index.js +618 -0
- package/node_modules/safe-stable-stringify/package.json +69 -0
- package/node_modules/safe-stable-stringify/readme.md +170 -0
- package/node_modules/safe-stable-stringify/tsconfig.json +22 -0
- package/node_modules/winston/LICENSE +18 -18
- package/node_modules/winston/README.md +1231 -1230
- package/node_modules/winston/dist/winston/common.js +10 -10
- package/node_modules/winston/dist/winston/config/index.js +17 -17
- package/node_modules/winston/dist/winston/container.js +46 -46
- package/node_modules/winston/dist/winston/create-logger.js +28 -24
- package/node_modules/winston/dist/winston/exception-handler.js +49 -49
- package/node_modules/winston/dist/winston/exception-stream.js +27 -27
- package/node_modules/winston/dist/winston/logger.js +152 -138
- package/node_modules/winston/dist/winston/profiler.js +22 -22
- package/node_modules/winston/dist/winston/rejection-handler.js +54 -54
- package/node_modules/winston/dist/winston/tail-file.js +14 -14
- package/node_modules/winston/dist/winston/transports/console.js +31 -31
- package/node_modules/winston/dist/winston/transports/file.js +101 -101
- package/node_modules/winston/dist/winston/transports/http.js +119 -41
- package/node_modules/winston/dist/winston/transports/index.js +17 -17
- package/node_modules/winston/dist/winston/transports/stream.js +24 -24
- package/node_modules/winston/dist/winston.js +91 -97
- package/node_modules/winston/index.d.ts +213 -193
- package/node_modules/winston/lib/winston/common.js +61 -61
- package/node_modules/winston/lib/winston/config/index.d.ts +99 -98
- package/node_modules/winston/lib/winston/config/index.js +35 -35
- package/node_modules/winston/lib/winston/container.js +114 -114
- package/node_modules/winston/lib/winston/create-logger.js +104 -104
- package/node_modules/winston/lib/winston/exception-handler.js +245 -245
- package/node_modules/winston/lib/winston/exception-stream.js +54 -54
- package/node_modules/winston/lib/winston/logger.js +676 -667
- package/node_modules/winston/lib/winston/profiler.js +51 -51
- package/node_modules/winston/lib/winston/rejection-handler.js +251 -251
- package/node_modules/winston/lib/winston/tail-file.js +124 -124
- package/node_modules/winston/lib/winston/transports/console.js +117 -117
- package/node_modules/winston/lib/winston/transports/file.js +695 -695
- package/node_modules/winston/lib/winston/transports/http.js +267 -202
- package/node_modules/winston/lib/winston/transports/index.d.ts +103 -100
- package/node_modules/winston/lib/winston/transports/index.js +56 -56
- package/node_modules/winston/lib/winston/transports/stream.js +63 -63
- package/node_modules/winston/lib/winston.js +176 -182
- package/node_modules/winston/node_modules/winston-transport/.babelrc +3 -0
- package/node_modules/winston/node_modules/winston-transport/.eslintrc +7 -0
- package/node_modules/winston/node_modules/winston-transport/.gitattributes +1 -0
- package/node_modules/winston/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
- package/node_modules/winston/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
- package/node_modules/winston/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -0
- package/node_modules/winston/node_modules/winston-transport/CHANGELOG.md +126 -0
- package/node_modules/winston/node_modules/winston-transport/LICENSE +22 -0
- package/node_modules/winston/node_modules/winston-transport/README.md +50 -0
- package/node_modules/winston/node_modules/winston-transport/dist/index.js +215 -0
- package/node_modules/winston/node_modules/winston-transport/dist/legacy.js +116 -0
- package/node_modules/winston/node_modules/winston-transport/index.d.ts +39 -0
- package/node_modules/winston/node_modules/winston-transport/index.js +215 -0
- package/node_modules/winston/node_modules/winston-transport/legacy.js +119 -0
- package/node_modules/winston/node_modules/winston-transport/package.json +56 -0
- package/node_modules/winston/package.json +76 -75
- package/package.json +9 -6
- package/node_modules/@dabh/diagnostics/example.png +0 -0
- package/node_modules/color-string/CHANGELOG.md +0 -18
- package/node_modules/colorspace/test.js +0 -14
- package/node_modules/fecha/CHANGELOG.md +0 -67
- package/node_modules/logform/.travis.yml +0 -17
- package/node_modules/winston/CHANGELOG.md +0 -560
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# @colors/colors ("colors.js")
|
|
2
|
+
[](https://github.com/DABH/colors.js/actions/workflows/ci.yml)
|
|
3
|
+
[](https://www.npmjs.org/package/@colors/colors)
|
|
4
|
+
|
|
5
|
+
Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. Please open Issues to provide feedback.
|
|
6
|
+
|
|
7
|
+
## get color and style in your node.js console
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
npm install @colors/colors
|
|
14
|
+
|
|
15
|
+
## colors and styles!
|
|
16
|
+
|
|
17
|
+
### text colors
|
|
18
|
+
|
|
19
|
+
- black
|
|
20
|
+
- red
|
|
21
|
+
- green
|
|
22
|
+
- yellow
|
|
23
|
+
- blue
|
|
24
|
+
- magenta
|
|
25
|
+
- cyan
|
|
26
|
+
- white
|
|
27
|
+
- gray
|
|
28
|
+
- grey
|
|
29
|
+
|
|
30
|
+
### bright text colors
|
|
31
|
+
|
|
32
|
+
- brightRed
|
|
33
|
+
- brightGreen
|
|
34
|
+
- brightYellow
|
|
35
|
+
- brightBlue
|
|
36
|
+
- brightMagenta
|
|
37
|
+
- brightCyan
|
|
38
|
+
- brightWhite
|
|
39
|
+
|
|
40
|
+
### background colors
|
|
41
|
+
|
|
42
|
+
- bgBlack
|
|
43
|
+
- bgRed
|
|
44
|
+
- bgGreen
|
|
45
|
+
- bgYellow
|
|
46
|
+
- bgBlue
|
|
47
|
+
- bgMagenta
|
|
48
|
+
- bgCyan
|
|
49
|
+
- bgWhite
|
|
50
|
+
- bgGray
|
|
51
|
+
- bgGrey
|
|
52
|
+
|
|
53
|
+
### bright background colors
|
|
54
|
+
|
|
55
|
+
- bgBrightRed
|
|
56
|
+
- bgBrightGreen
|
|
57
|
+
- bgBrightYellow
|
|
58
|
+
- bgBrightBlue
|
|
59
|
+
- bgBrightMagenta
|
|
60
|
+
- bgBrightCyan
|
|
61
|
+
- bgBrightWhite
|
|
62
|
+
|
|
63
|
+
### styles
|
|
64
|
+
|
|
65
|
+
- reset
|
|
66
|
+
- bold
|
|
67
|
+
- dim
|
|
68
|
+
- italic
|
|
69
|
+
- underline
|
|
70
|
+
- inverse
|
|
71
|
+
- hidden
|
|
72
|
+
- strikethrough
|
|
73
|
+
|
|
74
|
+
### extras
|
|
75
|
+
|
|
76
|
+
- rainbow
|
|
77
|
+
- zebra
|
|
78
|
+
- america
|
|
79
|
+
- trap
|
|
80
|
+
- random
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
By popular demand, `@colors/colors` now ships with two types of usages!
|
|
86
|
+
|
|
87
|
+
The super nifty way
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
var colors = require('@colors/colors');
|
|
91
|
+
|
|
92
|
+
console.log('hello'.green); // outputs green text
|
|
93
|
+
console.log('i like cake and pies'.underline.red); // outputs red underlined text
|
|
94
|
+
console.log('inverse the color'.inverse); // inverses the color
|
|
95
|
+
console.log('OMG Rainbows!'.rainbow); // rainbow
|
|
96
|
+
console.log('Run the trap'.trap); // Drops the bass
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
or a slightly less nifty way which doesn't extend `String.prototype`
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
var colors = require('@colors/colors/safe');
|
|
104
|
+
|
|
105
|
+
console.log(colors.green('hello')); // outputs green text
|
|
106
|
+
console.log(colors.red.underline('i like cake and pies')); // outputs red underlined text
|
|
107
|
+
console.log(colors.inverse('inverse the color')); // inverses the color
|
|
108
|
+
console.log(colors.rainbow('OMG Rainbows!')); // rainbow
|
|
109
|
+
console.log(colors.trap('Run the trap')); // Drops the bass
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
|
|
114
|
+
|
|
115
|
+
If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
|
|
116
|
+
|
|
117
|
+
## Enabling/Disabling Colors
|
|
118
|
+
|
|
119
|
+
The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
node myapp.js --no-color
|
|
123
|
+
node myapp.js --color=false
|
|
124
|
+
|
|
125
|
+
node myapp.js --color
|
|
126
|
+
node myapp.js --color=true
|
|
127
|
+
node myapp.js --color=always
|
|
128
|
+
|
|
129
|
+
FORCE_COLOR=1 node myapp.js
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Or in code:
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
var colors = require('@colors/colors');
|
|
136
|
+
colors.enable();
|
|
137
|
+
colors.disable();
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
var name = 'Beowulf';
|
|
144
|
+
console.log(colors.green('Hello %s'), name);
|
|
145
|
+
// outputs -> 'Hello Beowulf'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Custom themes
|
|
149
|
+
|
|
150
|
+
### Using standard API
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
|
|
154
|
+
var colors = require('@colors/colors');
|
|
155
|
+
|
|
156
|
+
colors.setTheme({
|
|
157
|
+
silly: 'rainbow',
|
|
158
|
+
input: 'grey',
|
|
159
|
+
verbose: 'cyan',
|
|
160
|
+
prompt: 'grey',
|
|
161
|
+
info: 'green',
|
|
162
|
+
data: 'grey',
|
|
163
|
+
help: 'cyan',
|
|
164
|
+
warn: 'yellow',
|
|
165
|
+
debug: 'blue',
|
|
166
|
+
error: 'red'
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// outputs red text
|
|
170
|
+
console.log("this is an error".error);
|
|
171
|
+
|
|
172
|
+
// outputs yellow text
|
|
173
|
+
console.log("this is a warning".warn);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Using string safe API
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
var colors = require('@colors/colors/safe');
|
|
180
|
+
|
|
181
|
+
// set single property
|
|
182
|
+
var error = colors.red;
|
|
183
|
+
error('this is red');
|
|
184
|
+
|
|
185
|
+
// set theme
|
|
186
|
+
colors.setTheme({
|
|
187
|
+
silly: 'rainbow',
|
|
188
|
+
input: 'grey',
|
|
189
|
+
verbose: 'cyan',
|
|
190
|
+
prompt: 'grey',
|
|
191
|
+
info: 'green',
|
|
192
|
+
data: 'grey',
|
|
193
|
+
help: 'cyan',
|
|
194
|
+
warn: 'yellow',
|
|
195
|
+
debug: 'blue',
|
|
196
|
+
error: 'red'
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// outputs red text
|
|
200
|
+
console.log(colors.error("this is an error"));
|
|
201
|
+
|
|
202
|
+
// outputs yellow text
|
|
203
|
+
console.log(colors.warn("this is a warning"));
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Combining Colors
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
var colors = require('@colors/colors');
|
|
211
|
+
|
|
212
|
+
colors.setTheme({
|
|
213
|
+
custom: ['red', 'underline']
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
console.log('test'.custom);
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var colors = require('../lib/index');
|
|
2
|
+
|
|
3
|
+
console.log('First some yellow text'.yellow);
|
|
4
|
+
|
|
5
|
+
console.log('Underline that text'.yellow.underline);
|
|
6
|
+
|
|
7
|
+
console.log('Make it bold and red'.red.bold);
|
|
8
|
+
|
|
9
|
+
console.log(('Double Raindows All Day Long').rainbow);
|
|
10
|
+
|
|
11
|
+
console.log('Drop the bass'.trap);
|
|
12
|
+
|
|
13
|
+
console.log('DROP THE RAINBOW BASS'.trap.rainbow);
|
|
14
|
+
|
|
15
|
+
// styles not widely supported
|
|
16
|
+
console.log('Chains are also cool.'.bold.italic.underline.red);
|
|
17
|
+
|
|
18
|
+
// styles not widely supported
|
|
19
|
+
console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse
|
|
20
|
+
+ ' styles! '.yellow.bold);
|
|
21
|
+
console.log('Zebras are so fun!'.zebra);
|
|
22
|
+
|
|
23
|
+
//
|
|
24
|
+
// Remark: .strikethrough may not work with Mac OS Terminal App
|
|
25
|
+
//
|
|
26
|
+
console.log('This is ' + 'not'.strikethrough + ' fun.');
|
|
27
|
+
|
|
28
|
+
console.log('Background color attack!'.black.bgWhite);
|
|
29
|
+
console.log('Use random styles on everything!'.random);
|
|
30
|
+
console.log('America, Heck Yeah!'.america);
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line max-len
|
|
33
|
+
console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
|
|
34
|
+
|
|
35
|
+
console.log('Setting themes is useful');
|
|
36
|
+
|
|
37
|
+
//
|
|
38
|
+
// Custom themes
|
|
39
|
+
//
|
|
40
|
+
console.log('Generic logging theme as JSON'.green.bold.underline);
|
|
41
|
+
// Load theme with JSON literal
|
|
42
|
+
colors.setTheme({
|
|
43
|
+
silly: 'rainbow',
|
|
44
|
+
input: 'grey',
|
|
45
|
+
verbose: 'cyan',
|
|
46
|
+
prompt: 'grey',
|
|
47
|
+
info: 'green',
|
|
48
|
+
data: 'grey',
|
|
49
|
+
help: 'cyan',
|
|
50
|
+
warn: 'yellow',
|
|
51
|
+
debug: 'blue',
|
|
52
|
+
error: 'red',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// outputs red text
|
|
56
|
+
console.log('this is an error'.error);
|
|
57
|
+
|
|
58
|
+
// outputs yellow text
|
|
59
|
+
console.log('this is a warning'.warn);
|
|
60
|
+
|
|
61
|
+
// outputs grey text
|
|
62
|
+
console.log('this is an input'.input);
|
|
63
|
+
|
|
64
|
+
console.log('Generic logging theme as file'.green.bold.underline);
|
|
65
|
+
|
|
66
|
+
// Load a theme from file
|
|
67
|
+
try {
|
|
68
|
+
colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.log(err);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// outputs red text
|
|
74
|
+
console.log('this is an error'.error);
|
|
75
|
+
|
|
76
|
+
// outputs yellow text
|
|
77
|
+
console.log('this is a warning'.warn);
|
|
78
|
+
|
|
79
|
+
// outputs grey text
|
|
80
|
+
console.log('this is an input'.input);
|
|
81
|
+
|
|
82
|
+
// console.log("Don't summon".zalgo)
|
|
83
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var colors = require('../safe');
|
|
2
|
+
|
|
3
|
+
console.log(colors.yellow('First some yellow text'));
|
|
4
|
+
|
|
5
|
+
console.log(colors.yellow.underline('Underline that text'));
|
|
6
|
+
|
|
7
|
+
console.log(colors.red.bold('Make it bold and red'));
|
|
8
|
+
|
|
9
|
+
console.log(colors.rainbow('Double Raindows All Day Long'));
|
|
10
|
+
|
|
11
|
+
console.log(colors.trap('Drop the bass'));
|
|
12
|
+
|
|
13
|
+
console.log(colors.rainbow(colors.trap('DROP THE RAINBOW BASS')));
|
|
14
|
+
|
|
15
|
+
// styles not widely supported
|
|
16
|
+
console.log(colors.bold.italic.underline.red('Chains are also cool.'));
|
|
17
|
+
|
|
18
|
+
// styles not widely supported
|
|
19
|
+
console.log(colors.green('So ') + colors.underline('are') + ' '
|
|
20
|
+
+ colors.inverse('inverse') + colors.yellow.bold(' styles! '));
|
|
21
|
+
|
|
22
|
+
console.log(colors.zebra('Zebras are so fun!'));
|
|
23
|
+
|
|
24
|
+
console.log('This is ' + colors.strikethrough('not') + ' fun.');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
console.log(colors.black.bgWhite('Background color attack!'));
|
|
28
|
+
console.log(colors.random('Use random styles on everything!'));
|
|
29
|
+
console.log(colors.america('America, Heck Yeah!'));
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line max-len
|
|
32
|
+
console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!'));
|
|
33
|
+
|
|
34
|
+
console.log('Setting themes is useful');
|
|
35
|
+
|
|
36
|
+
//
|
|
37
|
+
// Custom themes
|
|
38
|
+
//
|
|
39
|
+
// console.log('Generic logging theme as JSON'.green.bold.underline);
|
|
40
|
+
// Load theme with JSON literal
|
|
41
|
+
colors.setTheme({
|
|
42
|
+
silly: 'rainbow',
|
|
43
|
+
input: 'blue',
|
|
44
|
+
verbose: 'cyan',
|
|
45
|
+
prompt: 'grey',
|
|
46
|
+
info: 'green',
|
|
47
|
+
data: 'grey',
|
|
48
|
+
help: 'cyan',
|
|
49
|
+
warn: 'yellow',
|
|
50
|
+
debug: 'blue',
|
|
51
|
+
error: 'red',
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// outputs red text
|
|
55
|
+
console.log(colors.error('this is an error'));
|
|
56
|
+
|
|
57
|
+
// outputs yellow text
|
|
58
|
+
console.log(colors.warn('this is a warning'));
|
|
59
|
+
|
|
60
|
+
// outputs blue text
|
|
61
|
+
console.log(colors.input('this is an input'));
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
// console.log('Generic logging theme as file'.green.bold.underline);
|
|
65
|
+
|
|
66
|
+
// Load a theme from file
|
|
67
|
+
colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
|
|
68
|
+
|
|
69
|
+
// outputs red text
|
|
70
|
+
console.log(colors.error('this is an error'));
|
|
71
|
+
|
|
72
|
+
// outputs yellow text
|
|
73
|
+
console.log(colors.warn('this is a warning'));
|
|
74
|
+
|
|
75
|
+
// outputs grey text
|
|
76
|
+
console.log(colors.input('this is an input'));
|
|
77
|
+
|
|
78
|
+
// console.log(colors.zalgo("Don't summon him"))
|
|
79
|
+
|
|
80
|
+
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// Type definitions for @colors/colors 1.4+
|
|
2
|
+
// Project: https://github.com/Marak/colors.js
|
|
3
|
+
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
|
|
4
|
+
// Definitions: https://github.com/DABH/colors.js
|
|
5
|
+
|
|
6
|
+
export interface Color {
|
|
7
|
+
(text: string): string;
|
|
8
|
+
|
|
9
|
+
strip: Color;
|
|
10
|
+
stripColors: Color;
|
|
11
|
+
|
|
12
|
+
black: Color;
|
|
13
|
+
red: Color;
|
|
14
|
+
green: Color;
|
|
15
|
+
yellow: Color;
|
|
16
|
+
blue: Color;
|
|
17
|
+
magenta: Color;
|
|
18
|
+
cyan: Color;
|
|
19
|
+
white: Color;
|
|
20
|
+
gray: Color;
|
|
21
|
+
grey: Color;
|
|
22
|
+
|
|
23
|
+
bgBlack: Color;
|
|
24
|
+
bgRed: Color;
|
|
25
|
+
bgGreen: Color;
|
|
26
|
+
bgYellow: Color;
|
|
27
|
+
bgBlue: Color;
|
|
28
|
+
bgMagenta: Color;
|
|
29
|
+
bgCyan: Color;
|
|
30
|
+
bgWhite: Color;
|
|
31
|
+
|
|
32
|
+
reset: Color;
|
|
33
|
+
bold: Color;
|
|
34
|
+
dim: Color;
|
|
35
|
+
italic: Color;
|
|
36
|
+
underline: Color;
|
|
37
|
+
inverse: Color;
|
|
38
|
+
hidden: Color;
|
|
39
|
+
strikethrough: Color;
|
|
40
|
+
|
|
41
|
+
rainbow: Color;
|
|
42
|
+
zebra: Color;
|
|
43
|
+
america: Color;
|
|
44
|
+
trap: Color;
|
|
45
|
+
random: Color;
|
|
46
|
+
zalgo: Color;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function enable(): void;
|
|
50
|
+
export function disable(): void;
|
|
51
|
+
export function setTheme(theme: any): void;
|
|
52
|
+
|
|
53
|
+
export let enabled: boolean;
|
|
54
|
+
|
|
55
|
+
export const strip: Color;
|
|
56
|
+
export const stripColors: Color;
|
|
57
|
+
|
|
58
|
+
export const black: Color;
|
|
59
|
+
export const red: Color;
|
|
60
|
+
export const green: Color;
|
|
61
|
+
export const yellow: Color;
|
|
62
|
+
export const blue: Color;
|
|
63
|
+
export const magenta: Color;
|
|
64
|
+
export const cyan: Color;
|
|
65
|
+
export const white: Color;
|
|
66
|
+
export const gray: Color;
|
|
67
|
+
export const grey: Color;
|
|
68
|
+
|
|
69
|
+
export const bgBlack: Color;
|
|
70
|
+
export const bgRed: Color;
|
|
71
|
+
export const bgGreen: Color;
|
|
72
|
+
export const bgYellow: Color;
|
|
73
|
+
export const bgBlue: Color;
|
|
74
|
+
export const bgMagenta: Color;
|
|
75
|
+
export const bgCyan: Color;
|
|
76
|
+
export const bgWhite: Color;
|
|
77
|
+
|
|
78
|
+
export const reset: Color;
|
|
79
|
+
export const bold: Color;
|
|
80
|
+
export const dim: Color;
|
|
81
|
+
export const italic: Color;
|
|
82
|
+
export const underline: Color;
|
|
83
|
+
export const inverse: Color;
|
|
84
|
+
export const hidden: Color;
|
|
85
|
+
export const strikethrough: Color;
|
|
86
|
+
|
|
87
|
+
export const rainbow: Color;
|
|
88
|
+
export const zebra: Color;
|
|
89
|
+
export const america: Color;
|
|
90
|
+
export const trap: Color;
|
|
91
|
+
export const random: Color;
|
|
92
|
+
export const zalgo: Color;
|
|
93
|
+
|
|
94
|
+
declare global {
|
|
95
|
+
interface String {
|
|
96
|
+
strip: string;
|
|
97
|
+
stripColors: string;
|
|
98
|
+
|
|
99
|
+
black: string;
|
|
100
|
+
red: string;
|
|
101
|
+
green: string;
|
|
102
|
+
yellow: string;
|
|
103
|
+
blue: string;
|
|
104
|
+
magenta: string;
|
|
105
|
+
cyan: string;
|
|
106
|
+
white: string;
|
|
107
|
+
gray: string;
|
|
108
|
+
grey: string;
|
|
109
|
+
|
|
110
|
+
bgBlack: string;
|
|
111
|
+
bgRed: string;
|
|
112
|
+
bgGreen: string;
|
|
113
|
+
bgYellow: string;
|
|
114
|
+
bgBlue: string;
|
|
115
|
+
bgMagenta: string;
|
|
116
|
+
bgCyan: string;
|
|
117
|
+
bgWhite: string;
|
|
118
|
+
|
|
119
|
+
reset: string;
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
bold: string;
|
|
122
|
+
dim: string;
|
|
123
|
+
italic: string;
|
|
124
|
+
underline: string;
|
|
125
|
+
inverse: string;
|
|
126
|
+
hidden: string;
|
|
127
|
+
strikethrough: string;
|
|
128
|
+
|
|
129
|
+
rainbow: string;
|
|
130
|
+
zebra: string;
|
|
131
|
+
america: string;
|
|
132
|
+
trap: string;
|
|
133
|
+
random: string;
|
|
134
|
+
zalgo: string;
|
|
135
|
+
}
|
|
136
|
+
}
|