Skip to content

Releases: lukeed/kleur

v3.0.3

07 Apr 22:11
Compare
Choose a tag to compare

Patches

  • Add grey alias (#21): 59bdd40
    Thanks @lumio

  • Types: Export all interfaces (#23): 70e682d
    Thanks @Hammster

  • Always reopen code on shared code.close sequence: 10981d2

  • Internal: Track chain segments by code.open value, not color name: e9dbd08

  • Internal: Initialize all codes inline within factory: e9dbd08

  • Internal: Check code.close existence before String.replace: b1b41a8

  • Internal: Only String.replace on unique contents: e9dbd08

Chores

  • Update tests' expected ANSI for code.open sequences: 896c801
  • Update tests' expected ANSI for "nested" chains & reopened codes: c74f538
  • Update benchmark results: 35cbbc0

v3.0.2

08 Feb 20:54
Compare
Choose a tag to compare

Patches

  • Ensure this context isn't overridden by global (#18): 3d3a4cb

Chores

  • Update benchmark results: 9a3f313

v3.0.1

07 Dec 19:29
Compare
Choose a tag to compare

Patches

v3.0.0

15 Nov 21:38
Compare
Choose a tag to compare

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:
kleur.red.bold.underline('bolded, underlined, and red~!');


// After:
kleur.red().bold().underline('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 [email protected] with ansi-colors without any code/syntax changes.

Important: The release of [email protected] deprecates older kleur versions.

Features

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);

toError('Oops');


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

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

toError('Oops');

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.
See also NODE_DISABLE_COLORS.

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

const $ = {
  enabled: !NODE_DISABLE_COLORS && TERM !== 'dumb' && FORCE_COLOR !== '0'
};

v2.0.2

28 Aug 22:26
Compare
Choose a tag to compare

Patches

v2.0.1

28 Aug 22:28
Compare
Choose a tag to compare

Patches

v1.0.2

17 Jul 20:31
Compare
Choose a tag to compare

Patches

Chores

v1.0.1

11 Jul 21:57
Compare
Choose a tag to compare

Patches

  • Performance improvements: 9da1922, 9d1a735

    • Dropping the spread operator & the unnecessary function improved the op/s by 20k alone!
    • Reverted to object-type CODES for legibility & ~700 op/s gain

Chores