Back to Explore

lukeed/kleur

GitHub
3 watchersOpen source

Last release:

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

  • Maintenance status: Evidence suggests quiet or in maintenance mode rather than actively maintained, with the most recent upstream push in 2023-06-07 and the latest published updates shown in the provided history occurring in 2022-06-26 (v4.1.5).
  • Update cadence: After several updates in 2020, there are only a small number of updates over time (2021, then 2022), and no recent updates close to 2026-09-10, indicating very low cadence.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v4.1.5

    v4.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

    v4.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

    v4.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

    v4.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

    v4.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

    v4.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.

    Features
  • v4.0.3

    v4.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

    v4.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.

    Breaking
  • v4.0.1

    v4.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

    v4.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