kleur is a lightweight Node.js library for formatting terminal text with ANSI colors, supporting chained and nested colors, plus modifiers like bold and underline. It’s useful for adding colored, styled output to logs and CLI tools, with automatic color disabling for non-TTY output and the option to force-enable color support. A separate `kleur/colors` submodule supports tree-shaking via individual color imports (using nested calls instead of chaining).
Project status
- The source does not show active, frequent update activity in the provided recent history, with the newest noted update at v4.1.5 dated 2022-06-26, and the last upstream push dated 2023-06-07 (so maintenance appears present but not energetic).
- The apparent update cadence is slow, with updates spanning roughly 2020-09-30 (v4.1.3), 2021-01-22 (v4.1.4), and 2022-06-26 (v4.1.5), indicating long gaps between changes.
AI summary generated Today
Recent updates
v4.1.5
6/26/2022v4.1.5 makes the package friendlier to TypeScript and browser-like runtimes. It adds explicit type export conditions and prevents crashes when process.env is undefined by falling back to an empty object.
v4.1.4
1/22/2021v4.1.4 makes a small compatibility-focused change by replacing String/Array `includes()` usage with `indexOf()` so the library can run in older browsers without requiring polyfills. The diff also updates the README benchmark numbers to match the implementation change.
v4.1.3
9/30/2020v4.1.3 is a small patch release focused on improving compatibility in browser-like environments where process exists but process.stdout may be missing. It changes how isTTY is determined to prevent runtime errors when stdout is undefined.
v4.1.2
9/26/2020v4.1.2 focuses on terminal color enablement behavior around the NO_COLOR and FORCE_COLOR environment variables. The runtime logic was updated to better match the NO_COLOR spec, and the test suite was expanded to cover FORCE_COLOR= and NO_COLOR= edge cases (including empty values).
v4.1.1
8/19/2020v4.1.1 is a patch release that only changes TypeScript type declarations. The release notes state it was intended to fix unresolved typings for the `kleur/colors` entrypoint.
v4.1.0
8/13/2020v4.1.0 adds support for the NO_COLOR standard to disable ANSI color output based on environment variables. The release also includes a repository housekeeping change to enable GitHub Sponsors, with no other functional changes shown in the provided diff.
Featuresv4.0.3
7/31/2020v4.0.3 is a small patch release focused on improving compatibility when running in non-Node environments. The change adds a guard so the library does not reference `process` unless it exists, preventing import-time crashes in browsers.
v4.0.2
6/24/2020v4.0.2 changes how kleur decides whether to output ANSI color codes, adding more environment awareness around TTY detection. CI and tests were updated to cover stdout.isTTY and FORCE_COLOR/NODE_DISABLE_COLORS behavior, and the README documents the new non-TTY disabling behavior.
Breakingv4.0.1
6/19/2020v4.0.1 updates the package to support older Node.js versions by lowering the minimum Node engine requirement. It also adjusts the TypeScript type overloads for `kleur/colors` to better match the actual runtime behavior of `print` for `undefined` and `void` inputs.
v4.0.0
6/17/2020v4.0.0 adds first class ESM support for `kleur` via `package.json` `exports` and `module`, and introduces a new `kleur/colors` subpath that is intended to be fully treeshakeable. It also raises the minimum supported Node.js version to match the oldest active LTS. The codebase shifts to ESM-first sources (`index.mjs`, `colors.mjs`) with CommonJS entry points generated for `require`.
BreakingFeatures