Releases: lukeed/kleur
v3.0.3
Patches
-
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 beforeString.replace
: b1b41a8 -
Internal: Only
String.replace
on unique contents: e9dbd08
Chores
v3.0.2
v3.0.1
Patches
-
Fix: Set enumerable properties for object visibility (#18): 48b3027
Thanks @marvinhagemeister~! -
Fix: Improve TS typings for expected CommonJS behavior (#18): 48b3027
Thanks again @marvinhagemeister~!
v3.0.0
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 kleur@2.x
with ansi-colors
without any code/syntax changes.
Important: The release of
kleur@3.0
deprecates olderkleur
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 alsoNODE_DISABLE_COLORS
.
const { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env;
const $ = {
enabled: !NODE_DISABLE_COLORS && TERM !== 'dumb' && FORCE_COLOR !== '0'
};
v2.0.2
v2.0.1
v1.0.2
Patches
- Include TypeScript definitions: (#8): 0b44261
Thank you @madhavarshney and @rogierschouten
Chores
- Update benchmarks & results: 46205a9
- Update
enabled
example in README: 58496c9 - Clarify
ansi-colors
credits; with pitch & preference: 94d4f96