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 [email protected]
with ansi-colors
without any code/syntax changes.
Important: The release of
[email protected]
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
v1.0.1
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
- Update benchmark member:
[email protected]
: e865520 - Update benchmark results: 1ad595c