Skip to content
Permalink
Browse files

Remove `chalk.styles`

Very few consumers use this. Those who need it can just use the `ansi-styles` package directly.
  • Loading branch information...
sindresorhus committed Jun 20, 2017
1 parent 0412cdf commit 870249689acc6b04e81e96d2c09c39b76c640a94
Showing with 0 additions and 22 deletions.
  1. +0 −1 index.js
  2. +0 −15 readme.md
  3. +0 −6 test.js
@@ -155,5 +155,4 @@ function applyStyle() {
Object.defineProperties(Chalk.prototype, styles);

module.exports = new Chalk();
module.exports.styles = ansiStyles;
module.exports.supportsColor = supportsColor;
@@ -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

@@ -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');
});
});

0 comments on commit 8702496

Please sign in to comment.
You can’t perform that action at this time.