npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@stackline/ansicolors

v1.0.1

Published

Zero-dependency ANSI color wrappers with exact ansicolors compatibility and first-party types

Downloads

209

Readme

@stackline/ansicolors

npm version npm downloads CI license

Docs and ANSI preview | npm | GitHub | Migration | Security | Changelog

Current package version: 1.0.1

Zero-dependency ANSI foreground and background color wrappers. This package is a compatibility-first, independently maintained fork of [email protected], with accurate first-party types and current CommonJS, ESM, and browser distribution.

Stackline maintains this package independently. The original author does not endorse this fork.

Install

npm install @stackline/ansicolors

Existing projects can keep the package key and every require('ansicolors') call unchanged:

npm install ansicolors@npm:@stackline/ansicolors@^1.0.0

Usage

const colors = require('@stackline/ansicolors')

console.log(colors.red('failed'))
console.log(colors.bgGreen(colors.black('passed')))

Native ESM supports both default and named imports:

import colors, { bgBlue, brightWhite } from '@stackline/ansicolors'

console.log(bgBlue(brightWhite('ready')))
console.log(colors.green('connected'))

API

Foreground methods:

black blue cyan green magenta red white yellow
brightBlack brightBlue brightCyan brightGreen
brightMagenta brightRed brightWhite brightYellow

Background methods use the same names with a bg prefix:

bgBlack bgBlue bgCyan bgGreen bgMagenta bgRed bgWhite bgYellow
bgBrightBlack bgBrightBlue bgBrightCyan bgBrightGreen
bgBrightMagenta bgBrightRed bgBrightWhite bgBrightYellow

Every method surrounds its input with one opening SGR sequence and the historical foreground (39m) or background (49m) reset.

Escape Codes

Opening and closing sequences remain directly available as strings:

colors.open.blue       // '\u001b[34m'
colors.close.blue      // '\u001b[39m'
colors.open.bgYellow   // '\u001b[43m'
colors.close.bgYellow  // '\u001b[49m'

TypeScript

Declarations ship with the package and are tested with TypeScript 3.9 and the current compiler. Do not install @types/ansicolors for the scoped package.

The first-party declarations reflect runtime precisely: color properties are functions, while open and close properties are strings. This corrects the recursive callable shape exposed by the separate historical declaration package.

Browser

Package export conditions select self-contained browser builds for bundlers. Standalone artifacts are also available:

  • dist/ansicolors.browser.mjs
  • dist/ansicolors.browser.cjs
  • dist/ansicolors.global.js, exposing AnsiColors

Compatibility

Version 1.x preserves the observable [email protected] runtime contract:

  • all 32 method names and ANSI sequences;
  • exact string wrapping and JavaScript coercion behavior;
  • nested foreground/background byte order;
  • open and close maps;
  • method extraction and object property behavior;
  • CommonJS default object;
  • zero runtime dependencies.

The package intentionally does not add bold, italic, underline, terminal detection, color disabling, stripping, or nesting repair to the historical methods. Use a full terminal styling library when those features are required.

Verification

Release gates include the complete upstream suite, a full 32-color matrix, differential execution against official 0.3.2, coercion and object-contract tests, 100% core coverage, TypeScript 3.9/current compilation, CJS/ESM/browser checks, packed installation, package metadata linting, production audit, npm alias installation, and the complete [email protected] downstream suite.

Security

See SECURITY.md. No runtime CVE or GHSA is claimed for upstream ansicolors; this fork focuses on maintenance continuity, type correctness, distribution quality, and reproducible compatibility.

Migration

See MIGRATION.md for direct, alias, CommonJS, ESM, and TypeScript migration notes.

License And Attribution

MIT. See LICENSE and NOTICE. Original work copyright 2013 Thorsten Lorenz.