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

cli-color-lite

v1.0.0

Published

Ultra-tiny (<1 KB), zero-dependency ANSI terminal colors and text styles with chained formatting and NO_COLOR support.

Readme

🎨 cli-color-lite

Ultra-lightweight (< 1 KB), zero-dependency ANSI terminal text colorizer and formatter with chained syntax and NO_COLOR compliance.

npm version License: MIT Sponsor TypeScript Size


💡 Why cli-color-lite?

Most CLI tools and backend services pull in packages like chalk or colorette. While great, they often include nested sub-dependencies, complex color level detection, or modern ESM compatibility issues in hybrid environments.

cli-color-lite provides:

  • ⚡ Zero Dependencies — Less than 1 KB minified, pure native TypeScript.
  • 🔗 Fluent Chaining — Combine colors and modifiers effortlessly: colors.bold.red.bgYellow('ALERT').
  • 🧼 ANSI Code Stripping — Strip codes with colors.strip() when writing to raw log files.
  • 🎛️ NO_COLOR Standard Compliant — Automatically honors NO_COLOR, FORCE_COLOR, and non-TTY stdout streams.
  • 📦 Dual ESM & CommonJS — Works everywhere: Node.js, Bun, Deno, and CI/CD pipelines.

📥 Installation

# npm
npm install cli-color-lite

# pnpm
pnpm add cli-color-lite

# yarn
yarn add cli-color-lite

# bun
bun add cli-color-lite

🚀 Usage & Real-World Examples

1. Basic Colors & Formatting

import colors from 'cli-color-lite';

console.log(colors.green('✔ Build completed successfully!'));
console.log(colors.red('✖ Failed to connect to database.'));
console.log(colors.yellow('⚠ High memory usage detected.'));
console.log(colors.cyan('ℹ Server listening on port 3000.'));

2. Chained Styles & Backgrounds

import colors from 'cli-color-lite';

// Bold and Bright Colors:
console.log(colors.bold.greenBright('DONE'));

// Background Colors with Text Formatting:
console.log(colors.bold.white.bgRed(' CRITICAL ERROR '));

// Underline and Dim styles:
console.log(colors.dim.italic('Config loaded from /etc/app.json'));
console.log(colors.underline.blue('https://github.com/Piratha97'));

3. CLI Logger with ANSI Stripping

When outputting to terminal and saving to a log file simultaneously:

import fs from 'node:fs';
import colors from 'cli-color-lite';

function log(level: 'INFO' | 'WARN' | 'ERROR', message: string) {
  const badgeMap = {
    INFO: colors.bgBlue.bold.white(' INFO '),
    WARN: colors.bgYellow.bold.black(' WARN '),
    ERROR: colors.bgRed.bold.white(' ERROR '),
  };

  const terminalOutput = `${badgeMap[level]} ${message}`;
  console.log(terminalOutput);

  // Write plain text without ANSI escape sequences to file:
  fs.appendFileSync('server.log', colors.strip(terminalOutput) + '\n');
}

log('INFO', 'Database migration applied.');
log('ERROR', 'Connection timed out after 5000ms.');

📖 API Reference & Supported Styles

Foreground Colors

black, red, green, yellow, blue, magenta, cyan, white, gray

Bright Foreground Colors

redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright

Background Colors

bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite

Modifiers

bold, dim, italic, underline, inverse, hidden, strikethrough, reset

Methods & Properties:

  • colors.strip(str): Removes all ANSI escape codes from a string.
  • colors.enabled: Boolean flag to enable or disable color output.

💖 Support the Project

If cli-color-lite keeps your CLI output colorful and lightweight, please support continued development:

👉 Sponsor @Piratha97 on GitHub Sponsors


📄 License

MIT © 2026 Pirapaakaran Pirathapan