Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 8702496
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 22 deletions.
1 change: 0 additions & 1 deletion index.js
Expand Up @@ -155,5 +155,4 @@ function applyStyle() {
Object.defineProperties(Chalk.prototype, styles);

module.exports = new Chalk();
module.exports.styles = ansiStyles;
module.exports.supportsColor = supportsColor;
15 changes: 0 additions & 15 deletions readme.md
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions test.js
Expand Up @@ -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.