Releases: lukeed/kleur
v4.1.5
v4.1.4
Chores
-
Replace
includes()
usage withindexOf
to allow support for older browsers (#45): 86a7db8
No behavioral differences. Simply allowskleur
to run in old browsers (eg, IE8-11) without requiring a polyfill.
Thank you @Krinkle~! -
Update benchmarks to reflect
includes
->indexOf
update: 19764d4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
Features
- Add support for the
NO_COLOR
standard (#37): d839af7
Thank you @stramel~! 🎉
Chores
- Enable GitHub Sponsors button 🙇: 16bc034
v4.0.3
v4.0.2
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
Chores
v4.0.1
Patches
-
Revert 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/colors
overloaded definition: f2f33a8
Originalprint
order assumed that every export returnednull
, which is not true.
v4.0.0
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.x
or ignore the "engines" constraint of kleur@4.x
– its CommonJS files will still execute in a Node 6.x environment.
Features
-
Added native ESM support with
exports
map (for Node 12.18.x, Node 14+) (#30): 2da16a9
Thank you @kristoferbaxter~! -
Added
module
package entry (for bundler and PikaCDN) (#31): 2da16a9 -
Added new
kleur/colors
entry module: 049c080
These changes allow for import
statements with kleur
.
It's done in a way such that Node.js environments that natively support import
will 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/colors
is 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 the kleur
code you use.
If you're not ready to use ESM yet, require
statements 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') }"~!`))
);