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

chalk-fast

v1.0.0

Published

The fastest and tiniest terminal color library. <3KB, 2x faster than picocolors, supports 256/Truecolor, works everywhere.

Readme

chalk-fast

The fastest and tiniest terminal color library.

<3KB minified. 2x faster than picocolors. Supports 256/Truecolor. Works everywhere.

npm version bundle size License: MIT TypeScript


Why chalk-fast?

| Feature | chalk-fast | chalk | picocolors | kleur | ansis | |---------|------------|-------|------------|-------|-------| | Bundle size | <3KB | 44KB | 6KB | 21KB | 5.7KB | | Speed | Fastest | Slow | Fast | Medium | Fast | | ESM + CJS | Both | ESM only | CJS only | Both | Both | | 256 colors | Yes | Yes | No | No | Yes | | Truecolor | Yes | Yes | No | No | Yes | | Edge/Browser | Yes | No | Limited | No | Yes | | Zero deps | Yes | Yes | Yes | Yes | Yes | | TypeScript | Built-in | Built-in | Types | Types | Built-in |


Installation

npm install chalk-fast

Quick Start

// Direct imports (fastest)
import { red, green, bold, underline } from 'chalk-fast';

console.log(red('Error!'));
console.log(green('Success!'));
console.log(bold(red('Bold red!')));

// Chainable API
import chalk from 'chalk-fast';

console.log(chalk.red.bold('Hello'));
console.log(chalk.bgBlue.white.underline('World'));

Features

All Basic Colors

import {
  // Foreground
  black, red, green, yellow, blue, magenta, cyan, white, gray,
  // Bright
  redBright, greenBright, yellowBright, blueBright,
  // Background
  bgRed, bgGreen, bgBlue, bgYellow,
  // Modifiers
  bold, dim, italic, underline, strikethrough, inverse
} from 'chalk-fast';

console.log(red('Red text'));
console.log(bgBlue('Blue background'));
console.log(bold(underline('Bold and underlined')));

256 Colors

import { ansi256, bgAnsi256 } from 'chalk-fast';

console.log(ansi256(196)('Red from 256 palette'));
console.log(bgAnsi256(21)('Blue background'));

Truecolor (RGB/Hex)

import { rgb, bgRgb, hex, bgHex } from 'chalk-fast';

console.log(rgb(255, 100, 50)('Orange text'));
console.log(hex('#ff6432')('Same orange'));
console.log(bgRgb(0, 150, 255)('Blue background'));
console.log(bgHex('#0096ff')('Same blue'));

Chainable API

import chalk from 'chalk-fast';

// Chain multiple styles
console.log(chalk.red.bold.underline('Styled!'));
console.log(chalk.bgYellow.black.italic('Warning'));
console.log(chalk.rgb(255, 136, 0).bold('Custom color'));
console.log(chalk.hex('#ff8800').bgBlack('Hex color'));

Utilities

import { stripAnsi, hasAnsi, setColorEnabled, getColorLevel } from 'chalk-fast';

// Strip ANSI codes
const plain = stripAnsi(red('colored')); // 'colored'

// Check for ANSI codes
hasAnsi(red('test')); // true
hasAnsi('test');      // false

// Disable colors
setColorEnabled(false);

// Get color level (0=none, 1=basic, 2=256, 3=truecolor)
console.log(getColorLevel());

Benchmarks

--- SINGLE COLOR (red) ---
chalk-fast:  45,000,000 ops/sec
picocolors:  33,000,000 ops/sec
chalk:       24,000,000 ops/sec
=> chalk-fast is 1.4x faster than picocolors
=> chalk-fast is 1.9x faster than chalk

--- BOLD + COLOR ---
chalk-fast:  12,000,000 ops/sec
picocolors:   8,000,000 ops/sec
chalk:        4,000,000 ops/sec
=> chalk-fast is 1.5x faster than picocolors
=> chalk-fast is 3x faster than chalk

Run benchmarks yourself:

npm run bench

Environment Support

| Environment | Support | |-------------|---------| | Node.js 14+ | Full | | Deno | Full | | Bun | Full | | Browser | Full (devtools) | | Cloudflare Workers | Graceful fallback |

Color Detection

chalk-fast automatically detects color support:

  • NO_COLOR - Disables colors
  • FORCE_COLOR=0|1|2|3 - Force specific level
  • COLORTERM=truecolor - Enable truecolor
  • TTY detection - Auto-disable for pipes
import { setColorLevel, setColorEnabled } from 'chalk-fast';

// Force truecolor
setColorLevel(3);

// Disable all colors
setColorEnabled(false);

Migration from chalk

chalk-fast is a drop-in replacement:

- import chalk from 'chalk';
+ import chalk from 'chalk-fast';

chalk.red.bold('Hello'); // Works!

Or use direct imports (faster):

- import chalk from 'chalk';
- chalk.red('Hello');
+ import { red } from 'chalk-fast';
+ red('Hello');

API Reference

Colors

| Foreground | Background | Bright | |------------|------------|--------| | black | bgBlack | blackBright | | red | bgRed | redBright | | green | bgGreen | greenBright | | yellow | bgYellow | yellowBright | | blue | bgBlue | blueBright | | magenta | bgMagenta | magentaBright | | cyan | bgCyan | cyanBright | | white | bgWhite | whiteBright | | gray/grey | bgGray/bgGrey | |

Modifiers

| Modifier | Description | |----------|-------------| | bold | Bold text | | dim | Dimmed text | | italic | Italic text | | underline | Underlined text | | strikethrough | Strikethrough text | | inverse | Inverse colors | | hidden | Hidden text | | blink | Blinking text |

Extended Colors

| Function | Description | |----------|-------------| | rgb(r, g, b) | Truecolor foreground | | bgRgb(r, g, b) | Truecolor background | | hex('#rrggbb') | Hex foreground | | bgHex('#rrggbb') | Hex background | | ansi256(code) | 256-color foreground | | bgAnsi256(code) | 256-color background |

Utilities

| Function | Description | |----------|-------------| | stripAnsi(str) | Remove ANSI codes | | hasAnsi(str) | Check for ANSI codes | | setColorEnabled(bool) | Enable/disable colors | | setColorLevel(0-3) | Set color level | | getColorLevel() | Get current level |


Why Not...

chalk?

  • 44KB bundle (chalk-fast is <3KB)
  • ESM only (breaks CommonJS)
  • Slower performance

picocolors?

  • No 256-color or Truecolor
  • CJS only (not modernized)
  • No chainable API
  • Breaks in edge runtimes

kleur?

  • 21KB bundle
  • No 256-color or Truecolor
  • Slower than chalk-fast

ansis?

  • chalk-fast is smaller and faster
  • chalk-fast has simpler API

Support

If chalk-fast saved you time:

License

MIT