ansi-styles
Advanced tools
Comparing version 3.1.0 to 3.2.0
17
index.js
@@ -20,2 +20,3 @@ 'use strict'; | ||
function assembleStyles() { | ||
const codes = new Map(); | ||
const styles = { | ||
@@ -78,6 +79,6 @@ modifier: { | ||
Object.keys(styles).forEach(groupName => { | ||
for (const groupName of Object.keys(styles)) { | ||
const group = styles[groupName]; | ||
Object.keys(group).forEach(styleName => { | ||
for (const styleName of Object.keys(group)) { | ||
const style = group[styleName]; | ||
@@ -91,4 +92,6 @@ | ||
group[styleName] = styles[styleName]; | ||
}); | ||
codes.set(style[0], style[1]); | ||
} | ||
Object.defineProperty(styles, groupName, { | ||
@@ -98,4 +101,9 @@ value: group, | ||
}); | ||
}); | ||
Object.defineProperty(styles, 'codes', { | ||
value: codes, | ||
enumerable: false | ||
}); | ||
} | ||
const rgb2rgb = (r, g, b) => [r, g, b]; | ||
@@ -144,2 +152,3 @@ | ||
// Make the export immutable | ||
Object.defineProperty(module, 'exports', { | ||
@@ -146,0 +155,0 @@ enumerable: true, |
109
package.json
{ | ||
"name": "ansi-styles", | ||
"version": "3.1.0", | ||
"description": "ANSI escape codes for styling strings in the terminal", | ||
"license": "MIT", | ||
"repository": "chalk/ansi-styles", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"maintainers": [ | ||
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)", | ||
"Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)", | ||
"Josh Junon <i.am.qix@gmail.com> (github.com/qix-)" | ||
], | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"ansi", | ||
"styles", | ||
"color", | ||
"colour", | ||
"colors", | ||
"terminal", | ||
"console", | ||
"cli", | ||
"string", | ||
"tty", | ||
"escape", | ||
"formatting", | ||
"rgb", | ||
"256", | ||
"shell", | ||
"xterm", | ||
"log", | ||
"logging", | ||
"command-line", | ||
"text" | ||
], | ||
"dependencies": { | ||
"color-convert": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"babel-polyfill": "^6.23.0", | ||
"xo": "*" | ||
}, | ||
"ava": { | ||
"require": "babel-polyfill" | ||
} | ||
"name": "ansi-styles", | ||
"version": "3.2.0", | ||
"description": "ANSI escape codes for styling strings in the terminal", | ||
"license": "MIT", | ||
"repository": "chalk/ansi-styles", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"ansi", | ||
"styles", | ||
"color", | ||
"colour", | ||
"colors", | ||
"terminal", | ||
"console", | ||
"cli", | ||
"string", | ||
"tty", | ||
"escape", | ||
"formatting", | ||
"rgb", | ||
"256", | ||
"shell", | ||
"xterm", | ||
"log", | ||
"logging", | ||
"command-line", | ||
"text" | ||
], | ||
"dependencies": { | ||
"color-convert": "^1.9.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"babel-polyfill": "^6.23.0", | ||
"xo": "*" | ||
}, | ||
"ava": { | ||
"require": "babel-polyfill" | ||
} | ||
} |
@@ -13,3 +13,3 @@ # ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) | ||
``` | ||
$ npm install --save ansi-styles | ||
$ npm install ansi-styles | ||
``` | ||
@@ -26,4 +26,4 @@ | ||
// color conversion between 16/256/truecolor | ||
// NOTE: if conversion goes to 16 colors or 256 colors, the original color | ||
// Color conversion between 16/256/truecolor | ||
// NOTE: If conversion goes to 16 colors or 256 colors, the original color | ||
// may be degraded to fit that color palette. This means terminals | ||
@@ -49,7 +49,7 @@ // that do not support 16 million colors will best-match the | ||
- `dim` | ||
- `italic` *(not widely supported)* | ||
- `italic` *(Not widely supported)* | ||
- `underline` | ||
- `inverse` | ||
- `hidden` | ||
- `strikethrough` *(not widely supported)* | ||
- `strikethrough` *(Not widely supported)* | ||
@@ -66,5 +66,3 @@ ### Colors | ||
- `white` | ||
- `gray` | ||
- `blackBright` | ||
- `gray` ("bright black") | ||
- `redBright` | ||
@@ -88,3 +86,2 @@ - `greenBright` | ||
- `bgWhite` | ||
- `bgBlackBright` | ||
@@ -99,2 +96,3 @@ - `bgRedBright` | ||
## Advanced usage | ||
@@ -108,3 +106,2 @@ | ||
###### Example | ||
@@ -116,3 +113,12 @@ | ||
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. | ||
###### Example | ||
```js | ||
console.log(style.codes.get(36)); | ||
//=> 39 | ||
``` | ||
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) | ||
@@ -141,4 +147,10 @@ | ||
## Maintainers | ||
- [Sindre Sorhus](https://github.com/sindresorhus) | ||
- [Josh Junon](https://github.com/qix-) | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) | ||
MIT |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8886
127
148
Updatedcolor-convert@^1.9.0