Remove chalk.styles

Very few consumers use this. Those who need it can just use the `ansi-styles` package directly.
This commit is contained in:
Sindre Sorhus 2017-06-20 21:37:29 +02:00
parent 0412cdf07b
commit 870249689a
3 changed files with 0 additions and 22 deletions

View file

@ -155,5 +155,4 @@ function applyStyle() {
Object.defineProperties(Chalk.prototype, styles);
module.exports = new Chalk();
module.exports.styles = ansiStyles;
module.exports.supportsColor = supportsColor;

View file

@ -137,21 +137,6 @@ Detect whether the terminal [supports color](https://github.com/chalk/supports-c
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.
### chalk.styles
Exposes the styles as [ANSI escape codes](https://github.com/chalk/ansi-styles).
Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with your own.
```js
const chalk = require('chalk');
console.log(chalk.styles.red);
//=> {open: '\u001b[31m', close: '\u001b[39m'}
console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close);
```
## Styles

View file

@ -187,9 +187,3 @@ describe('chalk.constructor', () => {
assert.equal(chalk.red('foo'), '\u001B[31mfoo\u001B[39m');
});
});
describe('chalk.styles', () => {
it('should expose the styles as ANSI escape codes', () => {
assert.equal(chalk.styles.red.open, '\u001B[31m');
});
});