ansi-styles 1.0.0 → 1.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/{ansi-styles.js → index.js} +5 -3
- package/package.json +19 -25
- package/readme.md +32 -27
@@ -4,10 +4,12 @@ var styles = module.exports;
|
|
4
4
|
var codes = {
|
5
5
|
reset: [0, 0],
|
6
6
|
|
7
|
-
bold: [1, 22],
|
7
|
+
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
|
8
|
+
dim: [2, 22],
|
8
9
|
italic: [3, 23],
|
9
10
|
underline: [4, 24],
|
10
11
|
inverse: [7, 27],
|
12
|
+
hidden: [8, 28],
|
11
13
|
strikethrough: [9, 29],
|
12
14
|
|
13
15
|
black: [30, 39],
|
@@ -33,6 +35,6 @@ var codes = {
|
|
33
35
|
Object.keys(codes).forEach(function (key) {
|
34
36
|
var val = codes[key];
|
35
37
|
var style = styles[key] = {};
|
36
|
-
style.open = '\
|
37
|
-
style.close = '\
|
38
|
+
style.open = '\u001b[' + val[0] + 'm';
|
39
|
+
style.close = '\u001b[' + val[1] + 'm';
|
38
40
|
});
|
package/package.json
CHANGED
@@ -1,7 +1,23 @@
|
|
1
1
|
{
|
2
2
|
"name": "ansi-styles",
|
3
|
-
"version": "1.
|
4
|
-
"description": "ANSI escape codes for
|
3
|
+
"version": "1.1.0",
|
4
|
+
"description": "ANSI escape codes for styling strings in the terminal",
|
5
|
+
"license": "MIT",
|
6
|
+
"repository": "sindresorhus/ansi-styles",
|
7
|
+
"author": {
|
8
|
+
"name": "Sindre Sorhus",
|
9
|
+
"email": "sindresorhus@gmail.com",
|
10
|
+
"url": "http://sindresorhus.com"
|
11
|
+
},
|
12
|
+
"engines": {
|
13
|
+
"node": ">=0.10.0"
|
14
|
+
},
|
15
|
+
"scripts": {
|
16
|
+
"test": "mocha"
|
17
|
+
},
|
18
|
+
"files": [
|
19
|
+
"index.js"
|
20
|
+
],
|
5
21
|
"keywords": [
|
6
22
|
"ansi",
|
7
23
|
"styles",
|
@@ -24,29 +40,7 @@
|
|
24
40
|
"command-line",
|
25
41
|
"text"
|
26
42
|
],
|
27
|
-
"homepage": "https://github.com/sindresorhus/ansi-styles",
|
28
|
-
"bugs": "https://github.com/sindresorhus/ansi-styles/issues",
|
29
|
-
"license": "MIT",
|
30
|
-
"author": {
|
31
|
-
"name": "Sindre Sorhus",
|
32
|
-
"email": "sindresorhus@gmail.com",
|
33
|
-
"url": "http://sindresorhus.com"
|
34
|
-
},
|
35
|
-
"files": [
|
36
|
-
"ansi-styles.js"
|
37
|
-
],
|
38
|
-
"main": "ansi-styles",
|
39
|
-
"repository": {
|
40
|
-
"type": "git",
|
41
|
-
"url": "git://github.com/sindresorhus/ansi-styles.git"
|
42
|
-
},
|
43
|
-
"scripts": {
|
44
|
-
"test": "mocha"
|
45
|
-
},
|
46
43
|
"devDependencies": {
|
47
|
-
"mocha": "
|
48
|
-
},
|
49
|
-
"engines": {
|
50
|
-
"node": ">=0.8.0"
|
44
|
+
"mocha": "*"
|
51
45
|
}
|
52
46
|
}
|
package/readme.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# ansi-styles [](https://travis-ci.org/sindresorhus/ansi-styles)
|
2
2
|
|
3
|
-
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for
|
3
|
+
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling 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
|
|
@@ -9,10 +9,12 @@ You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk
|
|
9
9
|
|
10
10
|
## Install
|
11
11
|
|
12
|
-
|
12
|
+
```sh
|
13
|
+
$ npm install --save ansi-styles
|
14
|
+
```
|
13
15
|
|
14
16
|
|
15
|
-
##
|
17
|
+
## Usage
|
16
18
|
|
17
19
|
```js
|
18
20
|
var ansi = require('ansi-styles');
|
@@ -20,6 +22,7 @@ var ansi = require('ansi-styles');
|
|
20
22
|
console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
|
21
23
|
```
|
22
24
|
|
25
|
+
|
23
26
|
## API
|
24
27
|
|
25
28
|
Each style has an `open` and `close` property.
|
@@ -29,35 +32,37 @@ Each style has an `open` and `close` property.
|
|
29
32
|
|
30
33
|
### General
|
31
34
|
|
32
|
-
- reset
|
33
|
-
- bold
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
35
|
+
- `reset`
|
36
|
+
- `bold`
|
37
|
+
- `dim`
|
38
|
+
- `italic` *(not widely supported)*
|
39
|
+
- `underline`
|
40
|
+
- `inverse`
|
41
|
+
- `hidden`
|
42
|
+
- `strikethrough` *(not widely supported)*
|
38
43
|
|
39
44
|
### Text colors
|
40
45
|
|
41
|
-
- black
|
42
|
-
- red
|
43
|
-
- green
|
44
|
-
- yellow
|
45
|
-
- blue
|
46
|
-
- magenta
|
47
|
-
- cyan
|
48
|
-
- white
|
49
|
-
- gray
|
46
|
+
- `black`
|
47
|
+
- `red`
|
48
|
+
- `green`
|
49
|
+
- `yellow`
|
50
|
+
- `blue`
|
51
|
+
- `magenta`
|
52
|
+
- `cyan`
|
53
|
+
- `white`
|
54
|
+
- `gray`
|
50
55
|
|
51
56
|
### Background colors
|
52
57
|
|
53
|
-
- bgBlack
|
54
|
-
- bgRed
|
55
|
-
- bgGreen
|
56
|
-
- bgYellow
|
57
|
-
- bgBlue
|
58
|
-
- bgMagenta
|
59
|
-
- bgCyan
|
60
|
-
- bgWhite
|
58
|
+
- `bgBlack`
|
59
|
+
- `bgRed`
|
60
|
+
- `bgGreen`
|
61
|
+
- `bgYellow`
|
62
|
+
- `bgBlue`
|
63
|
+
- `bgMagenta`
|
64
|
+
- `bgCyan`
|
65
|
+
- `bgWhite`
|
61
66
|
|
62
67
|
|
63
68
|
## License
|