Back to Explore

sindresorhus/yoctocolors

GitHub
1 watchersOpen source

Last release: 9 months ago

yoctocolors is a small, fast JavaScript command-line coloring package that applies ANSI color and style formatting in the terminal, including support for nested colors. It is useful for styling CLI output (text colors, background colors, and modifiers like bold or underline) and can detect whether colors are supported, with FORCE_COLOR and NO_COLOR options to override behavior.

Project status

  • Actively maintained, latest activity shows up as an upstream push on 2025-08-21, with a subsequent tagged update v2.1.2 on 2025-08-19.
  • Update cadence appears low, v2.1.2 followed about a year after v2.1.1 (2024-07-03), and v2.1.1 followed shortly after v2.1.0 (2024-06-29).

AI summary generated Today

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

Recent updates

  • v2.1.2

    9 months ago

    Release v2.1.2 primarily fixes incorrect ANSI styling output when dim (SGR 2) and bold (SGR 1) are nested, especially because SGR 22 resets both. The code change updates the nested-color formatting logic and adds extensive test coverage for additional nesting edge cases.

  • v2.1.1

    7/3/2024

    v2.1.1 contains a targeted compatibility fix for Deno and a small documentation update. The code change makes the terminal color detection more defensive in runtimes where `node:tty` or its prototype methods are not available.

  • v2.1.0

    6/29/2024

    This release refactors the package entry point to add a default export while keeping the existing named color exports. The implementation was moved from index.js into a new base.js module, and index.js now re-exports from it (including a default export namespace). Release notes only mention default import support.

    Features
  • v2.0.2

    5/14/2024

    v2.0.2 makes a small internal change related to how nested ANSI color sequences are assembled. Release notes only mention removing some moot code, but the emitted escape sequence behavior for nested colors is different.

  • v2.0.1

    5/14/2024

    v2.0.1 focuses on fixing how yoctocolors handles nested color functions. The implementation changes the core formatting logic to detect closing escape codes and correctly reapply the outer color, plus updates tests and documentation to cover nested coloring.

  • v2.0.0

    3/1/2024

    This release of yoctocolors v2.0.0 adds a new set of bright foreground and bright background color formatters. It also raises the supported Node.js runtime to Node 18. The release notes cover these two items, but the code diff shows a few additional packaging and CI-related changes not mentioned.

    BreakingFeatures
  • v1.0.0

    6/30/2022

    This release primarily updates the package metadata and build/test configuration, and it is tagged as a breaking release. The main behavior-impacting change in the code diff is the Node.js support requirement in package.json.

    Breaking
  • v0.2.0

    10/27/2021

    v0.2.0 introduces basic terminal color detection so yoctocolors only emits ANSI escape codes when the runtime indicates colors are supported. The README and test configuration were also updated to reflect this behavior.

    BreakingFeatures
  • v0.1.1

    10/1/2021

    Release v0.1.1 adds TypeScript type declarations for yoctocolors. The code diff also updates the test setup to validate the types with tsd, and makes a couple of README wording/content tweaks.

    Features
  • v0.1.0

    10/1/2021

    Release v0.1.0 was published on 2021-10-01. The provided release notes contain no actionable information about features, fixes, breaking changes, or migration steps.