Ansis is a CJS and ESM ANSI color library for terminals, CI environments, and Chromium-based browser consoles, providing ANSI styles and 16, 256, and truecolor (hex and rgb) output. It is useful for writing colorful CLI and console logs with template-literal and chained syntax, with auto color detection and fallbacks.
Project status
- Actively maintained: the repo shows an upstream push on 2026-07-15, and the latest published updates are in 2026 (v4.3.1 on 2026-05-31, then v4.3.0 on 2026-05-24).
- Apparent update cadence: relatively fast iteration during late May 2026 (v4.3.0 to v4.3.1 in about 1 week), but with much longer gaps before that (next prior update was v4.2.0 on 2025-09-28).
AI summary generated
Recent updates
v4.3.1
v4.3.1 focuses on ANSI output correctness, fixing how `reset` sequences are generated, improving `strip()` to remove OSC 8 hyperlinks, and ensuring style state does not leak between `Ansis` instances with different color levels. The release notes also state that `.extend()` is now isolated to the instance it is called on.
Breakingv4.3.0
v4.3.0 adds OSC 8 terminal hyperlink support via a new `link(url, text?)` API, plus an `Ansis` constructor overload that allows injecting a mock `globalThis` (for controlled color auto-detection). The release also documents a bugfix to the precedence rules between `FORCE_COLOR`, `NO_COLOR`, and CLI `--color/--no-color` flags.
Featuresv4.2.0
v4.2.0 adds support for named truecolors, allowing you to pass a map of CSS color names (for example, from the `css-color-names` package) into `ansis.extend()`. It generates foreground methods from the provided names and automatically creates matching `bg*` background methods, with a fallback strategy that interpolates named truecolors down to the best color level supported by the current environment.
BreakingFeaturesv4.1.0
v4.1.0 introduces a new readonly `ansis.level` property that exposes the detected terminal color capability level (0 to 3). The release notes only mention this API addition, but the code diff also shows several packaging and build system changes related to publishing separate Node-targeted builds.
Featuresv4.0.0
v4.0.0 is a major API cleanup and internal refactor to keep Ansis smaller and more focused, while introducing better handling for tagged template literals and explicit color-level control. The release notes document several breaking alias removals and a TypeScript-focused redesign of extend().
BreakingFeaturesv3.18.0-beta.0
v3.18.0-beta.0 primarily focuses on Deno compatibility, explicitly adding Deno 2.0+ support while dropping Deno 1.x. The main implementation change affects how Ansis detects CLI color support in Deno by switching from Deno-specific APIs to the global Node-like `process` interface available in Deno 2.
BreakingFeaturesv4.0.0-beta
v4.0.0-beta focuses on reducing package size and cleaning up the public API, removing legacy or duplicate artifacts. The implementation refactors color support from a “color space” concept to a “color level” concept and tightens TypeScript definitions for a smaller .d.ts.
Featuresv3.17.0
Release v3.17.0 primarily targets TypeScript compatibility, updating the type declaration structure so older TypeScript (<5.6) can compile without TS2526. The code diff also updates tests and some example/README content, but there are no obvious runtime API changes shown in the provided diff beyond typing and test coverage.
Featuresv3.16.0
v3.16.0 is presented as a chore release: it reverts the full text of the ISC license, refactors for smaller output, and includes micro-optimizations related to named exports. Test coverage was also expanded with tsup bundler tests. The code diff, however, includes several behavioral and packaging related modifications that are not called out in the release notes.
Featuresv3.14.0
v3.14.0 adds improved color support for chromium-based browser consoles, and implements `\n` handling inside template literals so `red\`Hello\nWorld\`` renders as two lines. It also introduces `ansis.reset()` returning the reset escape code, adds `FORCE_COLOR`-based color forcing, and includes fixes around how `''`, `0`, `false`, and `NaN` are rendered.
Features