ansi-styles 2.0.1 → 2.1.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/index.js +60 -51
- package/package.json +5 -5
- package/readme.md +3 -3
package/index.js
CHANGED
@@ -1,56 +1,65 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
styles[styleName] = group[styleName] = {
|
47
|
-
open: '\u001b[' + style[0] + 'm',
|
48
|
-
close: '\u001b[' + style[1] + 'm'
|
49
|
-
};
|
50
|
-
});
|
3
|
+
function assembleStyles () {
|
4
|
+
var styles = {
|
5
|
+
modifiers: {
|
6
|
+
reset: [0, 0],
|
7
|
+
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
|
8
|
+
dim: [2, 22],
|
9
|
+
italic: [3, 23],
|
10
|
+
underline: [4, 24],
|
11
|
+
inverse: [7, 27],
|
12
|
+
hidden: [8, 28],
|
13
|
+
strikethrough: [9, 29]
|
14
|
+
},
|
15
|
+
colors: {
|
16
|
+
black: [30, 39],
|
17
|
+
red: [31, 39],
|
18
|
+
green: [32, 39],
|
19
|
+
yellow: [33, 39],
|
20
|
+
blue: [34, 39],
|
21
|
+
magenta: [35, 39],
|
22
|
+
cyan: [36, 39],
|
23
|
+
white: [37, 39],
|
24
|
+
gray: [90, 39]
|
25
|
+
},
|
26
|
+
bgColors: {
|
27
|
+
bgBlack: [40, 49],
|
28
|
+
bgRed: [41, 49],
|
29
|
+
bgGreen: [42, 49],
|
30
|
+
bgYellow: [43, 49],
|
31
|
+
bgBlue: [44, 49],
|
32
|
+
bgMagenta: [45, 49],
|
33
|
+
bgCyan: [46, 49],
|
34
|
+
bgWhite: [47, 49]
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
// fix humans
|
39
|
+
styles.colors.grey = styles.colors.gray;
|
40
|
+
|
41
|
+
Object.keys(styles).forEach(function (groupName) {
|
42
|
+
var group = styles[groupName];
|
43
|
+
|
44
|
+
Object.keys(group).forEach(function (styleName) {
|
45
|
+
var style = group[styleName];
|
51
46
|
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
styles[styleName] = group[styleName] = {
|
48
|
+
open: '\u001b[' + style[0] + 'm',
|
49
|
+
close: '\u001b[' + style[1] + 'm'
|
50
|
+
};
|
51
|
+
});
|
52
|
+
|
53
|
+
Object.defineProperty(styles, groupName, {
|
54
|
+
value: group,
|
55
|
+
enumerable: false
|
56
|
+
});
|
55
57
|
});
|
58
|
+
|
59
|
+
return styles;
|
60
|
+
}
|
61
|
+
|
62
|
+
Object.defineProperty(module, 'exports', {
|
63
|
+
enumerable: true,
|
64
|
+
get: assembleStyles
|
56
65
|
});
|
package/package.json
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "ansi-styles",
|
3
|
-
"version": "2.0
|
3
|
+
"version": "2.1.0",
|
4
4
|
"description": "ANSI escape codes for styling strings in the terminal",
|
5
5
|
"license": "MIT",
|
6
|
-
"repository": "
|
6
|
+
"repository": "chalk/ansi-styles",
|
7
7
|
"author": {
|
8
8
|
"name": "Sindre Sorhus",
|
9
9
|
"email": "sindresorhus@gmail.com",
|
10
|
-
"url": "
|
10
|
+
"url": "sindresorhus.com"
|
11
11
|
},
|
12
12
|
"maintainers": [
|
13
|
-
"Sindre Sorhus <sindresorhus@gmail.com> (
|
14
|
-
"Joshua Appelman <jappelman@xebia.com> (
|
13
|
+
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
|
14
|
+
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)"
|
15
15
|
],
|
16
16
|
"engines": {
|
17
17
|
"node": ">=0.10.0"
|
package/readme.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
2
2
|
|
3
3
|
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
4
4
|
|
5
|
-
You probably want the higher-level [chalk](https://github.com/
|
5
|
+
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
6
6
|
|
7
7
|

|
8
8
|
|
9
9
|
|
10
10
|
## Install
|
11
11
|
|
12
|
-
```
|
12
|
+
```
|
13
13
|
$ npm install --save ansi-styles
|
14
14
|
```
|
15
15
|
|