forked from orbit-oss/chalk
Update to latest ansi-styles
This commit is contained in:
parent
a66c486301
commit
879defda72
4 changed files with 8 additions and 9 deletions
2
chalk.js
2
chalk.js
|
|
@ -38,7 +38,7 @@ function init() {
|
||||||
|
|
||||||
return self._styles.reduce(function (str, name) {
|
return self._styles.reduce(function (str, name) {
|
||||||
var code = ansi[name];
|
var code = ansi[name];
|
||||||
return code[0] + (str || '') + code[1];
|
return code.open + (str || '') + code.close;
|
||||||
}, str);
|
}, str);
|
||||||
}, styles);
|
}, styles);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,11 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"has-color": "~0.1.0",
|
"has-color": "~0.1.0",
|
||||||
"ansi-styles": "~0.2.0",
|
"ansi-styles": "~1.0.0",
|
||||||
"strip-ansi": "~0.1.0"
|
"strip-ansi": "~0.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "~1.12.0"
|
"mocha": "~1.x"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8.0"
|
"node": ">=0.8.0"
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ console.log(chalk.blue.bgRed.bold('Hello world!'));
|
||||||
chalk.red('Hello', chalk.underline.bgBlue('world') + '!');
|
chalk.red('Hello', chalk.underline.bgBlue('world') + '!');
|
||||||
|
|
||||||
// pass in multiple arguments
|
// pass in multiple arguments
|
||||||
console.log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'))
|
console.log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||||
```
|
```
|
||||||
|
|
||||||
You can easily define your own themes.
|
You can easily define your own themes.
|
||||||
|
|
@ -85,15 +85,14 @@ Exposes the styles as [ANSI escape codes](https://github.com/sindresorhus/ansi-s
|
||||||
var chalk = require('chalk');
|
var chalk = require('chalk');
|
||||||
|
|
||||||
console.log(chalk.styles.red);
|
console.log(chalk.styles.red);
|
||||||
//=> ['\x1b[31m', '\x1b[39m']
|
//=> {open: '\x1b[31m', close: '\x1b[39m'}
|
||||||
|
|
||||||
console.log(chalk.styles.red[0] + 'Hello' + chalk.styles.red[1]);
|
console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close);
|
||||||
// first item is the style escape code and second is the reset escape code
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### chalk.stripColor(string)
|
### chalk.stripColor(string)
|
||||||
|
|
||||||
Strip color from a string.
|
[Strip color](https://github.com/sindresorhus/strip-ansi) from a string.
|
||||||
|
|
||||||
|
|
||||||
## Styles
|
## Styles
|
||||||
|
|
|
||||||
2
test.js
2
test.js
|
|
@ -49,7 +49,7 @@ describe('chalk.enabled', function () {
|
||||||
|
|
||||||
describe('chalk.styles', function () {
|
describe('chalk.styles', function () {
|
||||||
it('should expose the styles as ANSI escape codes', function () {
|
it('should expose the styles as ANSI escape codes', function () {
|
||||||
assert.equal(chalk.styles.red[0], '\x1b[31m');
|
assert.equal(chalk.styles.red.open, '\x1b[31m');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue