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.
Files changed (3) hide show
  1. package/index.js +60 -51
  2. package/package.json +5 -5
  3. package/readme.md +3 -3
package/index.js CHANGED
@@ -1,56 +1,65 @@
1
1
  'use strict';
2
2
 
3
- var styles = module.exports = {
4
- modifiers: {
5
- reset: [0, 0],
6
- bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
7
- dim: [2, 22],
8
- italic: [3, 23],
9
- underline: [4, 24],
10
- inverse: [7, 27],
11
- hidden: [8, 28],
12
- strikethrough: [9, 29]
13
- },
14
- colors: {
15
- black: [30, 39],
16
- red: [31, 39],
17
- green: [32, 39],
18
- yellow: [33, 39],
19
- blue: [34, 39],
20
- magenta: [35, 39],
21
- cyan: [36, 39],
22
- white: [37, 39],
23
- gray: [90, 39]
24
- },
25
- bgColors: {
26
- bgBlack: [40, 49],
27
- bgRed: [41, 49],
28
- bgGreen: [42, 49],
29
- bgYellow: [43, 49],
30
- bgBlue: [44, 49],
31
- bgMagenta: [45, 49],
32
- bgCyan: [46, 49],
33
- bgWhite: [47, 49]
34
- }
35
- };
36
-
37
- // fix humans
38
- styles.colors.grey = styles.colors.gray;
39
-
40
- Object.keys(styles).forEach(function (groupName) {
41
- var group = styles[groupName];
42
-
43
- Object.keys(group).forEach(function (styleName) {
44
- var style = group[styleName];
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
- Object.defineProperty(styles, groupName, {
53
- value: group,
54
- enumerable: false
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.1",
3
+ "version": "2.1.0",
4
4
  "description": "ANSI escape codes for styling strings in the terminal",
5
5
  "license": "MIT",
6
- "repository": "sindresorhus/ansi-styles",
6
+ "repository": "chalk/ansi-styles",
7
7
  "author": {
8
8
  "name": "Sindre Sorhus",
9
9
  "email": "sindresorhus@gmail.com",
10
- "url": "http://sindresorhus.com"
10
+ "url": "sindresorhus.com"
11
11
  },
12
12
  "maintainers": [
13
- "Sindre Sorhus <sindresorhus@gmail.com> (http://sindresorhus.com)",
14
- "Joshua Appelman <jappelman@xebia.com> (http://jbnicolai.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 [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles)
1
+ # ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](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/sindresorhus/chalk) module for styling your strings.
5
+ You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
6
6
 
7
7
  ![](screenshot.png)
8
8
 
9
9
 
10
10
  ## Install
11
11
 
12
- ```sh
12
+ ```
13
13
  $ npm install --save ansi-styles
14
14
  ```
15
15