Skip to content

Releases: webdiscus/ansis

v3.16.0

21 Feb 19:53
f14481a
Compare
Choose a tag to compare

v3.16.0

Chore

  • Reverted the full text of ISC license.
  • Refactored code to reduce the package size.
  • Micro optimisations for named exports.

Test

  • Added tests for tsup bundler.

v3.14.0

14 Feb 21:43
d3cd44d
Compare
Choose a tag to compare

v3.14.0

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 \n as 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_COLOR value:

    • 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 engines to "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 codes
  • Cast falsy values false and NaN to 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'

v3.5.2

02 Jan 16:09
9c3555f
Compare
Choose a tag to compare

v3.5.2

Features

  • Optimised the npm package size from 10.3 kB to 7.0 kB.

    Now, Ansis is the smallest yet most powerful library with rich functionality.
    A slightly smaller is picocolors (6.4 kB), but it offers only basic functionality.

  • Added detection of the xterm-direct terminal as supportingtruecolor.
  • Added support for the COLORTERM environment variable with the following values: truecolor, 24bit, ansi256, ansi (16 colors).

Bug Fixes (TypeScript)

  • Fixed default import in TypeScript compiled with tsc:
    import ansis from 'ansis' now works so well as import * as ansis from 'ansis'.
  • Fixed the TS2339: Property 'strip' does not exist on type when the tsc option module is node16.

v3.4.0

23 Dec 00:05
88a067c
Compare
Choose a tag to compare

v3.4.0

Cumulative Release v3.3.2 - v3.4.0

Bug Fixes

  • Correct detect TTY on Windows platform.

Chore

  • Optimised the npm package to reduce size by ~1.1 kB, from 11.4 kB to 10.3 kB.
  • Added benchmarks for kolorist package.
  • Added new representative benchmarks by using combination of 1, 2, 3 and 4 styles.
  • Refactor: invisible code optimisations.

v3.3.1

18 Jul 15:10
84bb0e3
Compare
Choose a tag to compare

Chore

  • Improved performance, e.g. using chained styles: 70.000.000 -> 80.000.000 ops/sec
  • Optimised the code to reduce the size by ~600 bytes.
  • Minified index.d.ts to reduce the size by ~200 bytes.
  • Optimised README for NPM package to reduce the size by ~1 KB.

v3.3.0

14 Jul 17:23
d700050
Compare
Choose a tag to compare

Chore

  • Deleted old named import syntax DEPRECATED in v2.0.0 (2023-11-03)
    If you update the package from v1.x to v3.3.0 then check your code:
    ESM
    - import { red } from 'ansis/colors';
    + import { red } from 'ansis';
    CJS
    - const { red } = require('ansis/colors');
    + const { red } = require('ansis');
  • Cleanup pickages.json for NPM
  • Updated README for NPM

v3.2.1

12 Jul 10:19
d1be810
Compare
Choose a tag to compare

Chore

  • Reduce unpacked size of NPM package by ~ 1 KB
  • Optimized README for NPM

v3.2.0

06 Jun 08:56
7400c8a
Compare
Choose a tag to compare

Features

v3.1.1

15 Apr 13:45
8769dc8
Compare
Choose a tag to compare

Cumulative Release v3.0.1 - v3.1.1

Features

  • Added detection of color support when using PM2 process manager.

Bug Fixes

  • Correct interpret FORCE_COLOR=false or FORCE_COLOR=0 as force disable colors
    others values, e.g., FORCE_COLOR=true or FORCE_COLOR=1 - force enable colors.
    See https://force-color.org.

Chore

  • Reduce unpacked size from 49 KB to 14 KB.

v3.0.0

30 Mar 14:07
96a2a47
Compare
Choose a tag to compare

Features

  • Added detection of color spaces support: TrueColor, 256 colors, 16 colors, no color (black & white).
  • Added fallback for supported color space: truecolor —> 256 colors —> 16 colors —> no colors.
  • Improved performance for the hex() function.

BREAKING CHANGE

In the new major version 3.x are removed unused styles and methods.

⚠️ Warning

Before update, please check your code whether is used deleted styles and methods.

Support Node.js

Drop supports for Node <= 14. Minimal supported version is 15.0.0 (Released 2020-10-20).
In the theory the v3 can works with Node12, but we can't test it.

Deleted styles

The not widely supported styles are deleted:

  • faint (alias for dim), replace in your code with dim
  • doubleUnderline, replace in your code with underline
  • frame, replace in your code with underline
  • encircle, replace in your code with underline
  • overline, replace in your code with underline

Deleted methods

The methods are deleted:

  • ansi, replace in your code with ansi256 or fg
  • bgAnsi, replace in your code with bgAnsi256 or bg

Deleted clamp in functions

The clamp (0, 255) for the ANSI 256 codes and RGB values is removed, because is unused.
You should self check the function arguments.

The affected functions:

  • ansi256 and fg (alias to ansi256) - expected a code in the range 0 - 255
  • bgAnsi256 and bg (alias to bgAnsi256) - expected a code in the range0 - 255
  • rgb - expected r, g, b values in the range 0 - 255
  • bgRgb - expected r, g, b values in the range 0 - 255