ansi-styles 0.2.0 → 1.0.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/ansi-styles.js +33 -24
- package/package.json +1 -1
- package/readme.md +4 -4
package/ansi-styles.js
CHANGED
@@ -1,29 +1,38 @@
|
|
1
1
|
'use strict';
|
2
|
-
module.exports
|
3
|
-
reset: ['\x1b[0m', '\x1b[0m'],
|
2
|
+
var styles = module.exports;
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
underline: ['\x1b[4m', '\x1b[24m'],
|
8
|
-
inverse: ['\x1b[7m', '\x1b[27m'],
|
9
|
-
strikethrough: ['\x1b[9m', '\x1b[29m'],
|
4
|
+
var codes = {
|
5
|
+
reset: [0, 0],
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
magenta: ['\x1b[35m', '\x1b[39m'],
|
17
|
-
cyan: ['\x1b[36m', '\x1b[39m'],
|
18
|
-
white: ['\x1b[37m', '\x1b[39m'],
|
19
|
-
gray: ['\x1B[90m', '\x1b[39m'],
|
7
|
+
bold: [1, 22],
|
8
|
+
italic: [3, 23],
|
9
|
+
underline: [4, 24],
|
10
|
+
inverse: [7, 27],
|
11
|
+
strikethrough: [9, 29],
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
13
|
+
black: [30, 39],
|
14
|
+
red: [31, 39],
|
15
|
+
green: [32, 39],
|
16
|
+
yellow: [33, 39],
|
17
|
+
blue: [34, 39],
|
18
|
+
magenta: [35, 39],
|
19
|
+
cyan: [36, 39],
|
20
|
+
white: [37, 39],
|
21
|
+
gray: [90, 39],
|
22
|
+
|
23
|
+
bgBlack: [40, 49],
|
24
|
+
bgRed: [41, 49],
|
25
|
+
bgGreen: [42, 49],
|
26
|
+
bgYellow: [43, 49],
|
27
|
+
bgBlue: [44, 49],
|
28
|
+
bgMagenta: [45, 49],
|
29
|
+
bgCyan: [46, 49],
|
30
|
+
bgWhite: [47, 49]
|
29
31
|
};
|
32
|
+
|
33
|
+
Object.keys(codes).forEach(function (key) {
|
34
|
+
var val = codes[key];
|
35
|
+
var style = styles[key] = {};
|
36
|
+
style.open = '\x1b[' + val[0] + 'm';
|
37
|
+
style.close = '\x1b[' + val[1] + 'm';
|
38
|
+
});
|
package/package.json
CHANGED
package/readme.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ansi-styles [](http://travis-ci.org/sindresorhus/ansi-styles)
|
2
2
|
|
3
|
-
> ANSI escape codes for colorizing strings in the terminal.
|
3
|
+
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for colorizing strings in the terminal.
|
4
4
|
|
5
5
|
You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings.
|
6
6
|
|
@@ -17,12 +17,12 @@ Install with [npm](https://npmjs.org/package/ansi-styles): `npm install --save a
|
|
17
17
|
```js
|
18
18
|
var ansi = require('ansi-styles');
|
19
19
|
|
20
|
-
console.log(ansi.green
|
20
|
+
console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
|
21
21
|
```
|
22
22
|
|
23
23
|
## API
|
24
24
|
|
25
|
-
Each style
|
25
|
+
Each style has an `open` and `close` property.
|
26
26
|
|
27
27
|
|
28
28
|
## Styles
|
@@ -62,4 +62,4 @@ Each style is an array of a start and end escape code.
|
|
62
62
|
|
63
63
|
## License
|
64
64
|
|
65
|
-
MIT
|
65
|
+
MIT © [Sindre Sorhus](http://sindresorhus.com)
|