colors 1.2.0 → 1.2.1

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/LICENSE CHANGED
@@ -1,25 +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.
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,184 +1,184 @@
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)
6
-
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.
8
-
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
- ### background colors
33
-
34
- - bgBlack
35
- - bgRed
36
- - bgGreen
37
- - bgYellow
38
- - bgBlue
39
- - bgMagenta
40
- - bgCyan
41
- - bgWhite
42
-
43
- ### styles
44
-
45
- - reset
46
- - bold
47
- - dim
48
- - italic
49
- - underline
50
- - inverse
51
- - hidden
52
- - strikethrough
53
-
54
- ### extras
55
-
56
- - rainbow
57
- - zebra
58
- - america
59
- - trap
60
- - random
61
-
62
-
63
- ## Usage
64
-
65
- By popular demand, `colors` now ships with two types of usages!
66
-
67
- The super nifty way
68
-
69
- ```js
70
- var colors = require('colors');
71
-
72
- console.log('hello'.green); // outputs green text
73
- console.log('i like cake and pies'.underline.red) // outputs red underlined text
74
- console.log('inverse the color'.inverse); // inverses the color
75
- console.log('OMG Rainbows!'.rainbow); // rainbow
76
- console.log('Run the trap'.trap); // Drops the bass
77
-
78
- ```
79
-
80
- or a slightly less nifty way which doesn't extend `String.prototype`
81
-
82
- ```js
83
- var colors = require('colors/safe');
84
-
85
- console.log(colors.green('hello')); // outputs green text
86
- console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
87
- console.log(colors.inverse('inverse the color')); // inverses the color
88
- console.log(colors.rainbow('OMG Rainbows!')); // rainbow
89
- console.log(colors.trap('Run the trap')); // Drops the bass
90
-
91
- ```
92
-
93
- I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
94
-
95
- 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.
96
-
97
- ## Disabling Colors
98
-
99
- To disable colors you can pass the following arguments in the command line to your application:
100
-
101
- ```bash
102
- node myapp.js --no-color
103
- ```
104
-
105
- ## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
106
-
107
- ```js
108
- var name = 'Marak';
109
- console.log(colors.green('Hello %s'), name);
110
- // outputs -> 'Hello Marak'
111
- ```
112
-
113
- ## Custom themes
114
-
115
- ### Using standard API
116
-
117
- ```js
118
-
119
- var colors = require('colors');
120
-
121
- colors.setTheme({
122
- silly: 'rainbow',
123
- input: 'grey',
124
- verbose: 'cyan',
125
- prompt: 'grey',
126
- info: 'green',
127
- data: 'grey',
128
- help: 'cyan',
129
- warn: 'yellow',
130
- debug: 'blue',
131
- error: 'red'
132
- });
133
-
134
- // outputs red text
135
- console.log("this is an error".error);
136
-
137
- // outputs yellow text
138
- console.log("this is a warning".warn);
139
- ```
140
-
141
- ### Using string safe API
142
-
143
- ```js
144
- var colors = require('colors/safe');
145
-
146
- // set single property
147
- var error = colors.red;
148
- error('this is red');
149
-
150
- // set theme
151
- colors.setTheme({
152
- silly: 'rainbow',
153
- input: 'grey',
154
- verbose: 'cyan',
155
- prompt: 'grey',
156
- info: 'green',
157
- data: 'grey',
158
- help: 'cyan',
159
- warn: 'yellow',
160
- debug: 'blue',
161
- error: 'red'
162
- });
163
-
164
- // outputs red text
165
- console.log(colors.error("this is an error"));
166
-
167
- // outputs yellow text
168
- console.log(colors.warn("this is a warning"));
169
-
170
- ```
171
-
172
- ### Combining Colors
173
-
174
- ```javascript
175
- var colors = require('colors');
176
-
177
- colors.setTheme({
178
- custom: ['red', 'underline']
179
- });
180
-
181
- console.log('test'.custom);
182
- ```
183
-
184
- *Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
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)
6
+
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.
8
+
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
+ ### background colors
33
+
34
+ - bgBlack
35
+ - bgRed
36
+ - bgGreen
37
+ - bgYellow
38
+ - bgBlue
39
+ - bgMagenta
40
+ - bgCyan
41
+ - bgWhite
42
+
43
+ ### styles
44
+
45
+ - reset
46
+ - bold
47
+ - dim
48
+ - italic
49
+ - underline
50
+ - inverse
51
+ - hidden
52
+ - strikethrough
53
+
54
+ ### extras
55
+
56
+ - rainbow
57
+ - zebra
58
+ - america
59
+ - trap
60
+ - random
61
+
62
+
63
+ ## Usage
64
+
65
+ By popular demand, `colors` now ships with two types of usages!
66
+
67
+ The super nifty way
68
+
69
+ ```js
70
+ var colors = require('colors');
71
+
72
+ console.log('hello'.green); // outputs green text
73
+ console.log('i like cake and pies'.underline.red) // outputs red underlined text
74
+ console.log('inverse the color'.inverse); // inverses the color
75
+ console.log('OMG Rainbows!'.rainbow); // rainbow
76
+ console.log('Run the trap'.trap); // Drops the bass
77
+
78
+ ```
79
+
80
+ or a slightly less nifty way which doesn't extend `String.prototype`
81
+
82
+ ```js
83
+ var colors = require('colors/safe');
84
+
85
+ console.log(colors.green('hello')); // outputs green text
86
+ console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
87
+ console.log(colors.inverse('inverse the color')); // inverses the color
88
+ console.log(colors.rainbow('OMG Rainbows!')); // rainbow
89
+ console.log(colors.trap('Run the trap')); // Drops the bass
90
+
91
+ ```
92
+
93
+ I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
94
+
95
+ 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.
96
+
97
+ ## Disabling Colors
98
+
99
+ To disable colors you can pass the following arguments in the command line to your application:
100
+
101
+ ```bash
102
+ node myapp.js --no-color
103
+ ```
104
+
105
+ ## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
106
+
107
+ ```js
108
+ var name = 'Marak';
109
+ console.log(colors.green('Hello %s'), name);
110
+ // outputs -> 'Hello Marak'
111
+ ```
112
+
113
+ ## Custom themes
114
+
115
+ ### Using standard API
116
+
117
+ ```js
118
+
119
+ var colors = require('colors');
120
+
121
+ colors.setTheme({
122
+ silly: 'rainbow',
123
+ input: 'grey',
124
+ verbose: 'cyan',
125
+ prompt: 'grey',
126
+ info: 'green',
127
+ data: 'grey',
128
+ help: 'cyan',
129
+ warn: 'yellow',
130
+ debug: 'blue',
131
+ error: 'red'
132
+ });
133
+
134
+ // outputs red text
135
+ console.log("this is an error".error);
136
+
137
+ // outputs yellow text
138
+ console.log("this is a warning".warn);
139
+ ```
140
+
141
+ ### Using string safe API
142
+
143
+ ```js
144
+ var colors = require('colors/safe');
145
+
146
+ // set single property
147
+ var error = colors.red;
148
+ error('this is red');
149
+
150
+ // set theme
151
+ colors.setTheme({
152
+ silly: 'rainbow',
153
+ input: 'grey',
154
+ verbose: 'cyan',
155
+ prompt: 'grey',
156
+ info: 'green',
157
+ data: 'grey',
158
+ help: 'cyan',
159
+ warn: 'yellow',
160
+ debug: 'blue',
161
+ error: 'red'
162
+ });
163
+
164
+ // outputs red text
165
+ console.log(colors.error("this is an error"));
166
+
167
+ // outputs yellow text
168
+ console.log(colors.warn("this is a warning"));
169
+
170
+ ```
171
+
172
+ ### Combining Colors
173
+
174
+ ```javascript
175
+ var colors = require('colors');
176
+
177
+ colors.setTheme({
178
+ custom: ['red', 'underline']
179
+ });
180
+
181
+ console.log('test'.custom);
182
+ ```
183
+
184
+ *Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
@@ -1,78 +1,78 @@
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
-
16
- console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
17
-
18
- console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse + ' styles! '.yellow.bold); // styles not widely supported
19
- console.log("Zebras are so fun!".zebra);
20
-
21
- //
22
- // Remark: .strikethrough may not work with Mac OS Terminal App
23
- //
24
- console.log("This is " + "not".strikethrough + " fun.");
25
-
26
- console.log('Background color attack!'.black.bgWhite)
27
- console.log('Use random styles on everything!'.random)
28
- console.log('America, Heck Yeah!'.america)
29
-
30
-
31
- console.log('Setting themes is useful')
32
-
33
- //
34
- // Custom themes
35
- //
36
- console.log('Generic logging theme as JSON'.green.bold.underline);
37
- // Load theme with JSON literal
38
- colors.setTheme({
39
- silly: 'rainbow',
40
- input: 'grey',
41
- verbose: 'cyan',
42
- prompt: 'grey',
43
- info: 'green',
44
- data: 'grey',
45
- help: 'cyan',
46
- warn: 'yellow',
47
- debug: 'blue',
48
- error: 'red'
49
- });
50
-
51
- // outputs red text
52
- console.log("this is an error".error);
53
-
54
- // outputs yellow text
55
- console.log("this is a warning".warn);
56
-
57
- // outputs grey text
58
- console.log("this is an input".input);
59
-
60
- console.log('Generic logging theme as file'.green.bold.underline);
61
-
62
- // Load a theme from file
63
- try {
64
- colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
65
- } catch (err) {
66
- console.log(err);
67
- }
68
-
69
- // outputs red text
70
- console.log("this is an error".error);
71
-
72
- // outputs yellow text
73
- console.log("this is a warning".warn);
74
-
75
- // outputs grey text
76
- console.log("this is an input".input);
77
-
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
+
16
+ console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
17
+
18
+ console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse + ' styles! '.yellow.bold); // styles not widely supported
19
+ console.log("Zebras are so fun!".zebra);
20
+
21
+ //
22
+ // Remark: .strikethrough may not work with Mac OS Terminal App
23
+ //
24
+ console.log("This is " + "not".strikethrough + " fun.");
25
+
26
+ console.log('Background color attack!'.black.bgWhite)
27
+ console.log('Use random styles on everything!'.random)
28
+ console.log('America, Heck Yeah!'.america)
29
+
30
+
31
+ console.log('Setting themes is useful')
32
+
33
+ //
34
+ // Custom themes
35
+ //
36
+ console.log('Generic logging theme as JSON'.green.bold.underline);
37
+ // Load theme with JSON literal
38
+ colors.setTheme({
39
+ silly: 'rainbow',
40
+ input: 'grey',
41
+ verbose: 'cyan',
42
+ prompt: 'grey',
43
+ info: 'green',
44
+ data: 'grey',
45
+ help: 'cyan',
46
+ warn: 'yellow',
47
+ debug: 'blue',
48
+ error: 'red'
49
+ });
50
+
51
+ // outputs red text
52
+ console.log("this is an error".error);
53
+
54
+ // outputs yellow text
55
+ console.log("this is a warning".warn);
56
+
57
+ // outputs grey text
58
+ console.log("this is an input".input);
59
+
60
+ console.log('Generic logging theme as file'.green.bold.underline);
61
+
62
+ // Load a theme from file
63
+ try {
64
+ colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
65
+ } catch (err) {
66
+ console.log(err);
67
+ }
68
+
69
+ // outputs red text
70
+ console.log("this is an error".error);
71
+
72
+ // outputs yellow text
73
+ console.log("this is a warning".warn);
74
+
75
+ // outputs grey text
76
+ console.log("this is an input".input);
77
+
78
78
  //console.log("Don't summon".zalgo)