ansi-styles
Advanced tools
Comparing version 2.0.1 to 2.1.0
103
index.js
'use strict'; | ||
var styles = module.exports = { | ||
modifiers: { | ||
reset: [0, 0], | ||
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing | ||
dim: [2, 22], | ||
italic: [3, 23], | ||
underline: [4, 24], | ||
inverse: [7, 27], | ||
hidden: [8, 28], | ||
strikethrough: [9, 29] | ||
}, | ||
colors: { | ||
black: [30, 39], | ||
red: [31, 39], | ||
green: [32, 39], | ||
yellow: [33, 39], | ||
blue: [34, 39], | ||
magenta: [35, 39], | ||
cyan: [36, 39], | ||
white: [37, 39], | ||
gray: [90, 39] | ||
}, | ||
bgColors: { | ||
bgBlack: [40, 49], | ||
bgRed: [41, 49], | ||
bgGreen: [42, 49], | ||
bgYellow: [43, 49], | ||
bgBlue: [44, 49], | ||
bgMagenta: [45, 49], | ||
bgCyan: [46, 49], | ||
bgWhite: [47, 49] | ||
} | ||
}; | ||
function assembleStyles () { | ||
var styles = { | ||
modifiers: { | ||
reset: [0, 0], | ||
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing | ||
dim: [2, 22], | ||
italic: [3, 23], | ||
underline: [4, 24], | ||
inverse: [7, 27], | ||
hidden: [8, 28], | ||
strikethrough: [9, 29] | ||
}, | ||
colors: { | ||
black: [30, 39], | ||
red: [31, 39], | ||
green: [32, 39], | ||
yellow: [33, 39], | ||
blue: [34, 39], | ||
magenta: [35, 39], | ||
cyan: [36, 39], | ||
white: [37, 39], | ||
gray: [90, 39] | ||
}, | ||
bgColors: { | ||
bgBlack: [40, 49], | ||
bgRed: [41, 49], | ||
bgGreen: [42, 49], | ||
bgYellow: [43, 49], | ||
bgBlue: [44, 49], | ||
bgMagenta: [45, 49], | ||
bgCyan: [46, 49], | ||
bgWhite: [47, 49] | ||
} | ||
}; | ||
// fix humans | ||
styles.colors.grey = styles.colors.gray; | ||
// fix humans | ||
styles.colors.grey = styles.colors.gray; | ||
Object.keys(styles).forEach(function (groupName) { | ||
var group = styles[groupName]; | ||
Object.keys(styles).forEach(function (groupName) { | ||
var group = styles[groupName]; | ||
Object.keys(group).forEach(function (styleName) { | ||
var style = group[styleName]; | ||
Object.keys(group).forEach(function (styleName) { | ||
var style = group[styleName]; | ||
styles[styleName] = group[styleName] = { | ||
open: '\u001b[' + style[0] + 'm', | ||
close: '\u001b[' + style[1] + 'm' | ||
}; | ||
styles[styleName] = group[styleName] = { | ||
open: '\u001b[' + style[0] + 'm', | ||
close: '\u001b[' + style[1] + 'm' | ||
}; | ||
}); | ||
Object.defineProperty(styles, groupName, { | ||
value: group, | ||
enumerable: false | ||
}); | ||
}); | ||
Object.defineProperty(styles, groupName, { | ||
value: group, | ||
enumerable: false | ||
}); | ||
return styles; | ||
} | ||
Object.defineProperty(module, 'exports', { | ||
enumerable: true, | ||
get: assembleStyles | ||
}); |
{ | ||
"name": "ansi-styles", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "ANSI escape codes for styling strings in the terminal", | ||
"license": "MIT", | ||
"repository": "sindresorhus/ansi-styles", | ||
"repository": "chalk/ansi-styles", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
"url": "sindresorhus.com" | ||
}, | ||
"maintainers": [ | ||
"Sindre Sorhus <sindresorhus@gmail.com> (http://sindresorhus.com)", | ||
"Joshua Appelman <jappelman@xebia.com> (http://jbnicolai.com)" | ||
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)", | ||
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)" | ||
], | ||
@@ -16,0 +16,0 @@ "engines": { |
@@ -1,6 +0,6 @@ | ||
# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles) | ||
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) | ||
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal | ||
You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings. | ||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. | ||
@@ -12,3 +12,3 @@ ![](screenshot.png) | ||
```sh | ||
``` | ||
$ npm install --save ansi-styles | ||
@@ -15,0 +15,0 @@ ``` |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4721
57
0