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

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin