From 870249689acc6b04e81e96d2c09c39b76c640a94 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Tue, 20 Jun 2017 21:37:29 +0200 Subject: [PATCH] Remove `chalk.styles` Very few consumers use this. Those who need it can just use the `ansi-styles` package directly. --- index.js | 1 - readme.md | 15 --------------- test.js | 6 ------ 3 files changed, 22 deletions(-) diff --git a/index.js b/index.js index 50f0831..48df977 100644 --- a/index.js +++ b/index.js @@ -155,5 +155,4 @@ function applyStyle() { Object.defineProperties(Chalk.prototype, styles); module.exports = new Chalk(); -module.exports.styles = ansiStyles; module.exports.supportsColor = supportsColor; diff --git a/readme.md b/readme.md index d06e842..5ef196d 100644 --- a/readme.md +++ b/readme.md @@ -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 diff --git a/test.js b/test.js index e4df628..074c1cd 100644 --- a/test.js +++ b/test.js @@ -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'); - }); -});