coloureds 0.0.1-security → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of coloureds might be problematic. Click here for more details.

package/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Original Library
4
+ - Copyright (c) Marak Squires
5
+
6
+ Additional Functionality
7
+ - Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,221 @@
1
- # Security holding package
1
+ # colors.js
2
+ [![Build Status](https://travis-ci.org/Marak/colors.js.svg?branch=master)](https://travis-ci.org/Marak/colors.js)
3
+ [![version](https://img.shields.io/npm/v/colors.svg)](https://www.npmjs.org/package/colors)
4
+ [![dependencies](https://david-dm.org/Marak/colors.js.svg)](https://david-dm.org/Marak/colors.js)
5
+ [![devDependencies](https://david-dm.org/Marak/colors.js/dev-status.svg)](https://david-dm.org/Marak/colors.js#info=devDependencies)
2
6
 
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
7
+ Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. Please open Issues to provide feedback, and check the `develop` branch for the latest bleeding-edge updates.
4
8
 
5
- Please refer to www.npmjs.com/advisories?search=coloureds for more information.
9
+ ## get color and style in your node.js console
10
+
11
+ ![Demo](https://raw.githubusercontent.com/Marak/colors.js/master/screenshots/colors.png)
12
+
13
+ ## Installation
14
+
15
+ npm install colors
16
+
17
+ ## colors and styles!
18
+
19
+ ### text colors
20
+
21
+ - black
22
+ - red
23
+ - green
24
+ - yellow
25
+ - blue
26
+ - magenta
27
+ - cyan
28
+ - white
29
+ - gray
30
+ - grey
31
+
32
+ ### bright text colors
33
+
34
+ - brightRed
35
+ - brightGreen
36
+ - brightYellow
37
+ - brightBlue
38
+ - brightMagenta
39
+ - brightCyan
40
+ - brightWhite
41
+
42
+ ### background colors
43
+
44
+ - bgBlack
45
+ - bgRed
46
+ - bgGreen
47
+ - bgYellow
48
+ - bgBlue
49
+ - bgMagenta
50
+ - bgCyan
51
+ - bgWhite
52
+ - bgGray
53
+ - bgGrey
54
+
55
+ ### bright background colors
56
+
57
+ - bgBrightRed
58
+ - bgBrightGreen
59
+ - bgBrightYellow
60
+ - bgBrightBlue
61
+ - bgBrightMagenta
62
+ - bgBrightCyan
63
+ - bgBrightWhite
64
+
65
+ ### styles
66
+
67
+ - reset
68
+ - bold
69
+ - dim
70
+ - italic
71
+ - underline
72
+ - inverse
73
+ - hidden
74
+ - strikethrough
75
+
76
+ ### extras
77
+
78
+ - rainbow
79
+ - zebra
80
+ - america
81
+ - trap
82
+ - random
83
+
84
+
85
+ ## Usage
86
+
87
+ By popular demand, `colors` now ships with two types of usages!
88
+
89
+ The super nifty way
90
+
91
+ ```js
92
+ var colors = require('colors');
93
+
94
+ console.log('hello'.green); // outputs green text
95
+ console.log('i like cake and pies'.underline.red) // outputs red underlined text
96
+ console.log('inverse the color'.inverse); // inverses the color
97
+ console.log('OMG Rainbows!'.rainbow); // rainbow
98
+ console.log('Run the trap'.trap); // Drops the bass
99
+
100
+ ```
101
+
102
+ or a slightly less nifty way which doesn't extend `String.prototype`
103
+
104
+ ```js
105
+ var colors = require('colors/safe');
106
+
107
+ console.log(colors.green('hello')); // outputs green text
108
+ console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
109
+ console.log(colors.inverse('inverse the color')); // inverses the color
110
+ console.log(colors.rainbow('OMG Rainbows!')); // rainbow
111
+ console.log(colors.trap('Run the trap')); // Drops the bass
112
+
113
+ ```
114
+
115
+ I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
116
+
117
+ 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.
118
+
119
+ ## Enabling/Disabling Colors
120
+
121
+ 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:
122
+
123
+ ```bash
124
+ node myapp.js --no-color
125
+ node myapp.js --color=false
126
+
127
+ node myapp.js --color
128
+ node myapp.js --color=true
129
+ node myapp.js --color=always
130
+
131
+ FORCE_COLOR=1 node myapp.js
132
+ ```
133
+
134
+ Or in code:
135
+
136
+ ```javascript
137
+ var colors = require('colors');
138
+ colors.enable();
139
+ colors.disable();
140
+ ```
141
+
142
+ ## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
143
+
144
+ ```js
145
+ var name = 'Marak';
146
+ console.log(colors.green('Hello %s'), name);
147
+ // outputs -> 'Hello Marak'
148
+ ```
149
+
150
+ ## Custom themes
151
+
152
+ ### Using standard API
153
+
154
+ ```js
155
+
156
+ var colors = require('colors');
157
+
158
+ colors.setTheme({
159
+ silly: 'rainbow',
160
+ input: 'grey',
161
+ verbose: 'cyan',
162
+ prompt: 'grey',
163
+ info: 'green',
164
+ data: 'grey',
165
+ help: 'cyan',
166
+ warn: 'yellow',
167
+ debug: 'blue',
168
+ error: 'red'
169
+ });
170
+
171
+ // outputs red text
172
+ console.log("this is an error".error);
173
+
174
+ // outputs yellow text
175
+ console.log("this is a warning".warn);
176
+ ```
177
+
178
+ ### Using string safe API
179
+
180
+ ```js
181
+ var colors = require('colors/safe');
182
+
183
+ // set single property
184
+ var error = colors.red;
185
+ error('this is red');
186
+
187
+ // set theme
188
+ colors.setTheme({
189
+ silly: 'rainbow',
190
+ input: 'grey',
191
+ verbose: 'cyan',
192
+ prompt: 'grey',
193
+ info: 'green',
194
+ data: 'grey',
195
+ help: 'cyan',
196
+ warn: 'yellow',
197
+ debug: 'blue',
198
+ error: 'red'
199
+ });
200
+
201
+ // outputs red text
202
+ console.log(colors.error("this is an error"));
203
+
204
+ // outputs yellow text
205
+ console.log(colors.warn("this is a warning"));
206
+
207
+ ```
208
+
209
+ ### Combining Colors
210
+
211
+ ```javascript
212
+ var colors = require('colors');
213
+
214
+ colors.setTheme({
215
+ custom: ['red', 'underline']
216
+ });
217
+
218
+ console.log('test'.custom);
219
+ ```
220
+
221
+ *Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
@@ -0,0 +1,82 @@
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
+ console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
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: 'grey',
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('this is an error'.error);
56
+
57
+ // outputs yellow text
58
+ console.log('this is a warning'.warn);
59
+
60
+ // outputs grey text
61
+ console.log('this is an input'.input);
62
+
63
+ console.log('Generic logging theme as file'.green.bold.underline);
64
+
65
+ // Load a theme from file
66
+ try {
67
+ colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
68
+ } catch (err) {
69
+ console.log(err);
70
+ }
71
+
72
+ // outputs red text
73
+ console.log('this is an error'.error);
74
+
75
+ // outputs yellow text
76
+ console.log('this is a warning'.warn);
77
+
78
+ // outputs grey text
79
+ console.log('this is an input'.input);
80
+
81
+ // console.log("Don't summon".zalgo)
82
+
@@ -0,0 +1,79 @@
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
+ console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!'));
32
+
33
+ console.log('Setting themes is useful');
34
+
35
+ //
36
+ // Custom themes
37
+ //
38
+ // console.log('Generic logging theme as JSON'.green.bold.underline);
39
+ // Load theme with JSON literal
40
+ colors.setTheme({
41
+ silly: 'rainbow',
42
+ input: 'blue',
43
+ verbose: 'cyan',
44
+ prompt: 'grey',
45
+ info: 'green',
46
+ data: 'grey',
47
+ help: 'cyan',
48
+ warn: 'yellow',
49
+ debug: 'blue',
50
+ error: 'red',
51
+ });
52
+
53
+ // outputs red text
54
+ console.log(colors.error('this is an error'));
55
+
56
+ // outputs yellow text
57
+ console.log(colors.warn('this is a warning'));
58
+
59
+ // outputs blue text
60
+ console.log(colors.input('this is an input'));
61
+
62
+
63
+ // console.log('Generic logging theme as file'.green.bold.underline);
64
+
65
+ // Load a theme from file
66
+ colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
67
+
68
+ // outputs red text
69
+ console.log(colors.error('this is an error'));
70
+
71
+ // outputs yellow text
72
+ console.log(colors.warn('this is a warning'));
73
+
74
+ // outputs grey text
75
+ console.log(colors.input('this is an input'));
76
+
77
+ // console.log(colors.zalgo("Don't summon him"))
78
+
79
+
package/index.d.ts ADDED
@@ -0,0 +1,136 @@
1
+ // Type definitions for Colors.js 1.2
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/Marak/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
+ }