kolorist

A tiny utility to colorize stdin/stdout

MIT 23 个版本
安装
npm install kolorist
yarn add kolorist
pnpm add kolorist
bun add kolorist
README

kolorist

Tiny library to put colors into stdin/stdout :tada:

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.

版本列表
1.8.0 2023-04-22
1.7.0 2023-02-03
1.6.0 2022-09-11
1.5.1 2021-12-17
1.5.0 2021-06-18
1.4.1 2021-04-24
1.4.0 2021-03-31
1.3.2 2021-03-17
1.3.1 2021-03-17
1.3.0 2021-03-17
1.2.10 2021-01-12
1.2.9 2021-01-02
1.2.8 2020-12-31
1.2.7 2020-10-13
1.2.6 2020-10-07
1.2.5 2020-10-07
1.2.4 2020-10-07
1.2.3 2020-08-05
1.2.2 2020-08-05
1.2.1 2020-05-25
1.2.0 2020-03-23
1.1.0 2020-02-20
1.0.0 2020-02-19