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:
parent
0412cdf07b
commit
870249689a
3 changed files with 0 additions and 22 deletions
1
index.js
1
index.js
|
|
@ -155,5 +155,4 @@ function applyStyle() {
|
||||||
Object.defineProperties(Chalk.prototype, styles);
|
Object.defineProperties(Chalk.prototype, styles);
|
||||||
|
|
||||||
module.exports = new Chalk();
|
module.exports = new Chalk();
|
||||||
module.exports.styles = ansiStyles;
|
|
||||||
module.exports.supportsColor = supportsColor;
|
module.exports.supportsColor = supportsColor;
|
||||||
|
|
|
||||||
15
readme.md
15
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`.
|
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
|
## Styles
|
||||||
|
|
||||||
|
|
|
||||||
6
test.js
6
test.js
|
|
@ -187,9 +187,3 @@ describe('chalk.constructor', () => {
|
||||||
assert.equal(chalk.red('foo'), '\u001B[31mfoo\u001B[39m');
|
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');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue