Urara-Blog/node_modules/.pnpm-store/v3/files/de/eb13ffb426633c93de94fe54f78da1599b33ae136fb97468e608c4516809516da56260ca8a5157b9220cbffb9039bff810cabf112ac3323f0e8c3bca9c7d1c
2022-08-14 01:14:53 +08:00

50 lines
882 B
Text

# kolorist
Tiny library to put colors into stdin/stdout :tada:
![Screenshot of terminal colors](screenshot.png)
## Usage
```bash
npm install --save-dev kolorist
```
```js
import { red, cyan } from 'kolorist';
console.log(red(`Error: something failed in ${cyan('my-file.js')}.`));
```
You can also disable or enable colors globally via the following environment variables:
- disable:
- `NODE_DISABLE_COLORS`
- `TERM=dumb`
- `FORCE_COLOR=0`
- enable:
- `FORCE_COLOR=1`
On top of that you can disable colors right from node:
```js
import { options, red } from 'kolorist';
options.enabled = false;
console.log(red('foo'));
// Logs a string without colors
```
You can also strip colors from a string:
```js
import { red, stripColors } from 'kolorist';
console.log(stripColors(red('foo')));
// Logs 'foo'
```
### License
`MIT`, see [the license file](./LICENSE).