|
|
il y a 1 mois | |
|---|---|---|
| .. | ||
| LICENSE | il y a 1 mois | |
| README.md | il y a 1 mois | |
| package.json | il y a 1 mois | |
Tiny library to put colors into stdin/stdout :tada:
npm install --save-dev kolorist
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_COLORSNO_COLORTERM=dumbFORCE_COLOR=0enable:
FORCE_COLOR=1FORCE_COLOR=2FORCE_COLOR=3On top of that you can disable colors right from node:
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:
import { red, stripColors } from 'kolorist';
console.log(stripColors(red('foo')));
// Logs 'foo'
MIT, see the license file.