ansis
4.5.0 · 1 Nov 2026ISC56.7M / weekRepositoryHomepagenpmAtom feed
3.17.0 is the newest release of 3.x.
In short
6 new3 fixed6 changed
Release note
Cumulative Release v3.6.0 - v3.14.0
Features
Added support for chromium-based browsers.\ Now you can use truecolor in the consoles of Chrome, Edge, Opera, Brave, Vivaldi and other Chromium-based browsers.
Browsers that do not support ANSI codes will display black and white text.Added support for
\nas a newline in template literals, e.g.:green`Hello\nWorld`renders:Hello World
Function
ansis.reset()returns the reset escape code\e[0m.Enforce a specific color support by a
FORCE_COLORvalue:false - Disables colors
0 - Disables colors
true (or unset) - Auto detects the supported colors (if no color detected, enforce truecolor)
1 - Enables 16 colors
2 - Enables 256 colors
3 - Enables truecolor
Removed undocumented pointless dummy function
ansis(any).
Warning
This is not a BREAKING CHANGE because it was never officially documented!
import ansis from 'ansis';
ansis('text'); // <= now will occur the ERROR TS2349: This expression is not callable. This warning applies only to projects where Chalk was replaced with Ansis and something like chalk('text') was used.
Just replace ansis('text') with 'text'.
The ansis('text') function was a dummy and did nothing except return the same input string.
Added support for legacy Node.js v14 (in package.json for npm was changed the
enginesto"node": ">=14").Micro optimisations for slight performance improvements.
Bug Fixes
If the function argument is an empty string should be returned an empty string w/o escape codes:
ansis.red('') => '', // returns empty string w/o escape codesCast falsy values
falseandNaNto a string.
In previous versions, the empty string''was returned for falsy values.Functions with argument
0, e.g.ansis.red(0), returning empty string'', now return colored value'0'