kleur
4.1.5 · 26 Jun 2022MIT176.8M / weekRepositoryHomepagenpmAtom feed
21 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 4.x · latest line
4.1.4
22 Jan 2021Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.
4.1.3
30 Sep 2020Add existence
process.stdoutcheck for browser-like polyfills (#42): 01963cc
Bundlers likeparcel,webpack, andbrowserifypolyfillprocessbut don't include astdoutimplementation.
Thank you @tinchoz49~!
4.1.2
26 Sep 20204.1.0
13 Aug 2020Add support for the
NO_COLORstandard (#37): d839af7
Thank you @stramel~! 🎉
Features
Add support for the
NO_COLORstandard (#37): d839af7
Thank you @stramel~! 🎉
4.0.2
24 Jun 2020Disable colorization if inside a TTY context (#33): 5c7353f
Thank you @ai~!# Before: $ npx app.js > log.txt #=> The `log.txt` filled with ANSI codes # After: $ npx app.js > log.txt #=> The `log.txt` is plain text # OVERRIDE: $ FORCE_COLOR=1 npx app.js > log.txt #=> The `log.txt` filled with ANSI codes; as requested
Patches
Disable colorization if inside a TTY context (#33): 5c7353f
Thank you @ai~!# Before: $ npx app.js > log.txt #=> The `log.txt` filled with ANSI codes # After: $ npx app.js > log.txt #=> The `log.txt` is plain text # OVERRIDE: $ FORCE_COLOR=1 npx app.js > log.txt #=> The `log.txt` filled with ANSI codes; as requested
4.0.1
19 Jun 2020Revert to Node 6.x minimum support: 8c01d93
The code works perfectly in that environment, so there's no reason not to.Truth be told, it was only bumped to 10.x because of the test runner constraint.(types) fix
kleur/colorsoverloaded definition: f2f33a8
Originalprintorder assumed that every export returnednull, which is not true.
4.0.0
17 Jun 2020Added native ESM support with
exportsmap (for Node 12.18.x, Node 14+) (#30): 2da16a9
Thank you @kristoferbaxter~!Added new
kleur/colorsentry module: 049c080
Breaking
The minimum Node.js runtime increased from 6.x to 10.x since 10.x is the oldest active LTS version.If you need to continue supporting Node 6.x, either continue using
kleur@3.xor ignore the "engines" constraint ofkleur@4.x– its CommonJS files will still execute in a Node 6.x environment.Features
Added native ESM support with
exportsmap (for Node 12.18.x, Node 14+) (#30): 2da16a9
Thank you @kristoferbaxter~!Added
modulepackage entry (for bundler and PikaCDN) (#31): 2da16a9Added new
kleur/colorsentry module: 049c080
These changes allow for
importstatements withkleur.It's done in a way such that Node.js environments that natively supportimportwill work. For those that don't and are using webpack/Rollup, the"module"entry is made available so that you can still take advantage of the ESM format.We took this idea one step further with
kleur/colors– which individually exports each color, modifier, and background function. This allows you to import only the methods you need, and the unused pieces of code are detached from your code. In other words,kleur/colorsis 100% treeshakeable, which is a big advantage of the ESM format. Node.js (with native ESM support), Rollup, and webpack benefit from this, which means that your programs only include/load thekleurcode you use.If you're not ready to use ESM yet,
requirestatements still work for both modules in all environments.See the Individual Colors documentation for more info
import kleur from 'kleur'; import * as colors from 'kleur/colors'; console.log( kleur.underline().green('kleur natively supports ESM~!') ); console.log( colors.white(colors.italic(`... so does "${ colors.green('kleur/colors') }"~!`)) );- 3.x
3.0.1
7 Dec 2018Set enumerable properties for object visibility (#18): 48b3027
Thanks @marvinhagemeister~!Improve TS typings for expected CommonJS behavior (#18): 48b3027
Thanks again @marvinhagemeister~!
3.0.0
15 Nov 2018This version is an intentional departure from the Chalk-like syntax. Any previous
kleurchains (those with more than one color) will not work with3.0and will require slight changes. Most libraries can expect to update their usage within a few minutes!Breaking (#16)
This version is an intentional departure from the Chalk-like syntax. Any previous
kleurchains (those with more than one color) will not work with3.0and 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-colorsinstead since (in most cases) it's a drop-in replacement for Chalk while staying significantly smaller and faster.You can also replace
kleur@2.xwithansi-colorswithout any code/syntax changes.Important: The release of
kleur@3.0deprecates olderkleurversions.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_COLORsince 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' };- 2.x
2.0.2
28 Aug 2018Improved TypeScript definitions (#14): 05ccfa8
Thanks @Rich-Harris~!
2.0.0
20 Jul 2018- 1.x
1.0.2
17 Jul 2018Include TypeScript definitions: (#8): 0b44261
Thank you @madhavarshney and @rogierschouten
Patches
Include TypeScript definitions: (#8): 0b44261
Thank you @madhavarshney and @rogierschouten
1.0.0
10 Jul 2018- 0.0.x
0.0.0
8 Jul 2018
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.