1. kolorist
A tiny utility to colorize stdin/stdout
kolorist
Package: kolorist
Created by: marvinhagemeister
Last modified: Sat, 22 Apr 2023 22:01:16 GMT
Version: 1.8.0
License: MIT
Downloads: 4,647,174
Repository: https://github.com/marvinhagemeister/kolorist

Install

npm install kolorist
yarn add kolorist

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.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code