Skip to content

@lukeed lukeed released this Nov 15, 2018 · 14 commits to master since this release

Breaking (#16)

This version is an intentional departure from the Chalk-like syntax. Any previous kleur chains (those with more than one color) will not work with 3.0 and will require slight changes. Most libraries can expect to update their usage within a few minutes!

// Before:'bolded, underlined, and red~!');

// After:'bolded, underlined, and red~!');

However, should you prefer the old syntax, please consider using ansi-colors instead since (in most cases) it's a drop-in replacement for Chalk while staying significantly smaller and faster.

You can also replace kleur@2.x with ansi-colors without any code/syntax changes.

Important: The release of kleur@3.0 deprecates older kleur versions.


Named Chains & Partial Requires

It's now possible to save color-chains directly as variables!

// Before:
const kleur = require('kleur');

const toError = msg => kleur.white.bold.bgRed(msg);


// After:
const { white } = require('kleur'); // now possible

const toError = white().bold().bgRed;


Detect Color Support (#13)

A (super) simple check for color support is now included, which sets the initial value for enabled.

Many libs attempt to toggle colors via FORCE_COLOR since this ENV is used by Chalk.

const { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env;

const $ = {
  enabled: !NODE_DISABLE_COLORS && TERM !== 'dumb' && FORCE_COLOR !== '0'
Assets 2
You can’t perform that action at this time.