kolorist
TypeScript icon, indicating that this package has built-in type declarations

1.8.0 • Public • Published

kolorist

Tiny library to put colors into stdin/stdout 🎉

Screenshot of terminal colors

Usage

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_COLORS
    • NO_COLOR
    • TERM=dumb
    • FORCE_COLOR=0
  • enable:

    • FORCE_COLOR=1
    • FORCE_COLOR=2
    • FORCE_COLOR=3

On 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'

License

MIT, see the license file.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.8.0
    1,163,180
    • latest

Version History

Package Sidebar

Install

npm i kolorist

Weekly Downloads

1,220,975

Version

1.8.0

License

MIT

Unpacked Size

51 kB

Total Files

11

Last publish

Collaborators

  • marvinhagemeister