Packages

ansis

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

Your version

62 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.

  1. 4.x · latest line
  2. 4.5.0

    1 Nov 2026
    • color-support: prevent colors in piped or redirected output when COLORTERM is set, #54

    • color-support: detect the color level for FORCE_COLOR=true and --color in non-TTY output

  3. 4.4.0

    13 Sep 2026

    Ansis now treats TERM=dumb as no color before applying COLORTERM, CI detection, PM2, Next.js runtime detection, and platform-specific defaults, #49.

  4. 4.3.1

    31 May 2026

    Before, reset was treated like any other style with an open and a close code, so it wrapped the value on both sides. That produced extra reset sequences in chained, nested, template literal, and multiline compositions, and the output did not match what a single reset should do.

  5. 4.3.0

    11 May 2026
    • Added link(url, text?) for OSC 8 hyperlinks, supported by many terminal emulators, #44

    • Added constructor overload to pass a mock globalThis object for controlled color auto-detection, #47

      import { Ansis } from 'ansis';
      
      const color = new Ansis({
        process: {
          env: { FORCE_COLOR: '1' },
          argv: ['node', 'app.js'],
          stdout: { isTTY: false },
          platform: 'linux',
        },
      });
      
      console.log(color.level); // 1
  6. 4.2.0

    28 Sep 2025

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

  7. 4.1.0

    28 May 2025
    • Added readonly level property to get the detected color support level:

      Access to detected color level:

      console.log('Detected color level: ', ansis.level);
  8. 4.0.0

    8 May 2025
    • breaking

      The strike style was rarely (if ever) used and added unnecessary redundancy.

    • breaking

      No usage of ansis.strike() was found in public GitHub repositories.

    • breaking

      Other ANSI libraries use the standard strikethrough name exclusively.

  9. 3.x
  10. 3.17.0

    2 Mar 2025

    Added support for older typescript versions (< 5.6) to fix TS2526 error:

  11. 3.16.0

    21 Feb 2025

    Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.

  12. 3.15.0

    16 Feb 2025
    • Reduce the package size by ~200 bytes.

  13. 3.14.0

    12 Feb 2025
    • 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.

  14. 3.12.0

    10 Feb 2025
    • Add support for \n as a newline in template literals, e.g.: green`Hello\nWorld` renders:

      Hello
      World
  15. 3.11.0

    9 Feb 2025
    • Add support for legacy Node.js v14 (in package.json for npm was changed the engines to "node": ">=14")

  16. 3.10.0

    27 Jan 2025
    • ansis.reset() returns the reset escape code \e[0m

    • Micro optimisations for slight performance improvements

  17. 3.9.0

    13 Jan 2025
    • Revert handling of null and undefined values to empty string as before v3.7.0, #25

  18. 3.8.1

    10 Jan 2025

    Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.

  19. 3.8.0

    9 Jan 2025
    • Enforce a specific color support by a FORCE_COLOR value:

    • 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
  20. 3.7.0

    7 Jan 2025
    • Cast falsy values false, null, undefined, 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'

  21. 3.6.0

    4 Jan 2025
    • Remove undocumented pointless dummy function ansis(any)

  22. 3.5.2

    27 Dec 2024
    • 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).

  23. 3.5.1

    26 Dec 2024

    Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.

  24. 3.5.0

    25 Dec 2024
    • removed

      Remove detection environment variable GPG_TTY introduced in 3.5.0-beta.0 version, because it make no sense

    • Add support the COLORTERM variable for values: truecolor, 24bit, ansi256, ansi (16 colors)

    • Add support the xterm-direct terminal to detect the truecolor

  25. 3.4.0

    14 Dec 2024
    • Correct detect TTY on Windows platform.

  26. 3.3.2

    23 Jul 2024
    • Correct detect TTY on Windows platform

  27. 3.2.1 – 3.3.13 releases with no change for you1 dependency updates, 2 maintenancepackage 3.3.0Show each
  28. 3.2.0

    24 Apr 2024
  29. 3.1.1

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

    • 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 force-color.org.

  30. 3.1.0

    9 Apr 2024
    • Add detection of color support when using PM2 process manager

  31. 3.0.1 – 3.0.33 maintenance releases: docs, tests or toolingShow each
    • 3.0.38 Apr 2024docs, tests or tooling
    • 3.0.28 Apr 2024docs, tests or tooling
    • 3.0.11 Apr 2024docs, tests or tooling
  32. 3.0.0

    29 Mar 2024
    • breaking

      faint (alias for dim), replace in your code with dim

    • breaking

      doubleUnderline, replace in your code with underline

    • breaking

      frame, replace in your code with underline

  33. 2.x
  34. 2.3.0

    15 Feb 2024
    • Added detection of additional terminals, thanks @dse, colors.js:issue #42.

    • Added supports the argument as number.

    • Added bgGrey and bgGray aliases for bgBlackBright.

  35. 2.2.0

    3 Feb 2024
    • Add supports the argument as number

  36. 2.1.0

    30 Jan 2024
    • Add bgGrey and bgGray aliases for bgBlackBright

  37. 2.0.3

    14 Dec 2023
    • index.d.ts: Use function overload to make the tagged template have the correct type, #16

  38. 2.0.2

    14 Nov 2023
    • Could not find a declaration file for module 'ansis'

  39. 2.0.1

    5 Nov 2023
    • Missing exports of ansis.strip() and ansis.export() functions (issue was introduced in v2.0.0)

  40. 2.0.0

    3 Nov 2023
    • deprecated

      OLD named import import { red } from 'ansis/colors' is deprecated, use the NEW named import.

    • deprecated

      The barely used ansi() function name is deprecated, use ansi256() or alias fg() instead.

    • deprecated

      The barely used bgAnsi() function name is deprecated, use bgAnsi256() or alias bg() instead.

  41. 1.x
  42. 1.5.6

    21 Sep 2023

    Only updates dependencies, nothing else changes.

  43. 1.5.5

    22 Sep 2022
    • Added support for nested template literal syntax:

      console.log(red`red ${yellow`yellow ${green`green`} yellow`} red`)
    • Added named export of colors with support for chained syntax:

      import { red, green, yellow } from 'ansis/colors';
      console.log(red.bold.underline`text`);
    • Added extending of base colors with named custom truecolor:

      import ansis from 'ansis';
      ansis.extend({ orange: '#FFAB40' });
      console.log(ansis.orange.bold('text'));
  44. 1.5.4

    14 Sep 2022
    • Visible style with nested template strings

  45. 1.5.3

    14 Sep 2022
    • Set correct aliases for bgAnsi and fg methods by named export

  46. 1.5.2

    9 Sep 2022
    • Regard the value of the environment variable FORCE_COLOR=0 to force disable colors

  47. 1.5.1

    8 Sep 2022
    • Add missing export for CJS mode in package.json

  48. 1.5.0

    8 Sep 2022
    • deprecated

      DEPRECATE v1.5.0, because missing exports main for CJS mode, fixed in v1.5.1

  49. 1.4.0

    2 Jul 2022
    • Add method strip() to remove all ANSI codes from string

  50. 1.3.6

    27 Apr 2022

    Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.