Packages

ansis

4.5.0 · 1 Nov 2026ISC56.7M / weekRepositoryHomepagenpmAtom feed

Your version

4.2.0

28 Sep 2025Where it was published

4.5.0 is the newest release of 4.x.

Release note

Feature

Added support named truecolors via ansis.extend() for both foreground and background.

Foreground methods are created from the provided color names, and matching background methods bg* are generated automatically.

output

Open in StackBlitz

Example:

import ansis from 'ansis';
import colorNames from 'css-color-names';

const color = ansis.extend(colorNames);

console.log(color.orange('Orange foreground'));
console.log(color.bgOrange('Orange background')); // auto-generated from "orange"

Note

The css-color-names (~6 kB) package exports CSS color names with their hex values.

This release removes the last barrier for projects migrating from Chalk v4 that used named truecolors:

- chalk.keyword('orange')('text');
+ color.orange('text');

- chalk.bgKeyword('orange')('text');
+ color.bgOrange('text');

Ansis provides this feature with a simpler, more intuitive API.

Important

Fallback for named truecolors

Ansis automatically interpolates named truecolors to the highest available color level supported by the current environment.
So you can safely use named truecolors anywhere without worrying about compatibility.