picocolors

The tiniest, fastest zero-dependency library for ANSI terminal color formatting in Node.js.

Library
npm
v1.1.1
1,756 stars
ISC

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
40 /100 Fair
Development Activity 0
Maintenance 20
Community 44
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
83 /100 Excellent
Architecture 78
Code Quality 80
Innovation 82
Learning Curve 90

picocolors is a zero-dependency JavaScript library for adding ANSI color and style formatting to terminal output. At roughly 7 KB installed and benchmarked up to 2x faster than Chalk, it exposes a flat set of formatter functions — colors, background colors, and text styles like bold, italic, and underline — built around a single lightweight closure that correctly handles nested color codes without corrupting output.

Because of its tiny footprint and lack of dependencies, picocolors has become a quiet standard in the Node.js tooling ecosystem: it ships inside PostCSS, Stylelint, SVGO, Browserslist, Vite, and many other widely-used build tools and CLIs, where minimizing node_modules bloat and startup time matters. It supports both CommonJS and ESM consumers, includes TypeScript declarations, respects the NO_COLOR convention, and ships a browser-safe build for bundlers that need one.

What You Get

  • Full ANSI color palette - Standard and bright foreground/background color functions (red, green, blue, gray, and their Bright/bg variants) covering all 16 base terminal colors.
  • Text style formatters - bold, dim, italic, underline, inverse, hidden, strikethrough, and reset functions for styling terminal text beyond color.
  • Nested-formatting safety - A replaceClose mechanism that correctly re-opens an outer color code when a nested formatter’s close sequence appears mid-string, avoiding the broken output some competing libraries produce.
  • Environment-aware color detection - An isColorSupported flag computed from NO_COLOR, FORCE_COLOR, --color/--no-color flags, TTY status, and CI environment, plus a createColors(enabled) factory to override it manually.
  • Dual CJS/ESM and browser builds - A Node-targeted CommonJS module plus a separate picocolors.browser.js build wired through package.json’s browser field, with bundled TypeScript type declarations.

Common Use Cases

  • CLI tool output - Formatting success/error/warning messages, prompts, and diffs in command-line tools without pulling in a heavier dependency tree.
  • Build tool and bundler logging - Coloring compiler/bundler console output (as used inside PostCSS, Vite, SVGO, Stylelint, and Browserslist) where install size and cold-start time affect every consumer’s build.
  • Drop-in Chalk replacement - Swapping out Chalk in existing codebases to shrink node_modules and speed up script startup, using the documented migration path for chained-call syntax.
  • Test runners and dev servers - Highlighting pass/fail output, stack traces, and status messages in local development tooling.

Under The Hood

Architecture picocolors is a single-file, dependency-free module built around one core primitive: a formatter closure that wraps text in ANSI open/close escape codes and handles nested closes via replaceClose (so nesting one color inside another doesn’t prematurely terminate the outer code). All roughly 40 color/style functions are generated by partially applying formatter with different escape sequences, avoiding per-function duplication. The createColors(enabled) factory produces either the real formatters or no-op passthroughs (() => String) based on a boolean, cleanly separating “does the terminal support color” from “format the string” — that separation is essentially the whole architecture. A parallel picocolors.browser.js variant ships for bundlers that need a browser build.

Tech Stack The stack is deliberately plain: dependency-free CommonJS JavaScript targeting Node 6+ and browsers, with a hand-written .d.ts for TypeScript consumers and a browser field in package.json to swap in a browser-safe build for bundlers. There is no build step, transpiler, or runtime dependency — the entire “stack” is authoring conventions (a Prettier config using tabs and no semicolons) and a tests/test.js file run directly by node, reflecting the project’s goal of minimizing everything downstream consumers have to install.

Code Quality The source is under 80 lines with tight, readable logic; naming is clear (isColorSupported, createColors, formatter), and the nested-color-code handling in replaceClose shows real attention to a subtle correctness edge case — nested ANSI codes resetting the wrong style — that several competing libraries get wrong. There’s no linter configuration beyond Prettier, and tests live in a small hand-rolled tests/test.js/tests/environments.js rather than a full test-runner framework, but the terse, single-file source is easy to read end-to-end in one sitting.

API Design The API is a flat object of self-explanatory formatter functions (pc.red(), pc.bold()) plus one power-user escape hatch (createColors(enabled)) for manually controlling color support — there’s no method chaining like Chalk’s, which keeps the mental model simple but requires nesting calls for combined styles (pc.red(pc.bold(text))). The isColorSupported boolean gives consumers an explicit flag to branch on, and because picocolors is a near drop-in replacement for Chalk, migration friction is low and documented directly in the README with a step-by-step “Replacing chalk” guide.

Used by 24 apps in this directory

TypeScript
94%
AGPL 3.0

Papra

Bookmarks Archiving

5,587

Self-hosted document archiving with email ingestion, OCR full-text search, and pluggable storage — store once, find anything.

View details
86
Repo Health
82
Technical
69
Dependency
Built with
TypeScript 94%
Updated yesterday
TypeScript
95%
MIT

Skrun

AI Agents

210

An open, self-hostable, multi-model agent runtime that deploys any agent skill as an API via POST /run — an open-source alternative to Claude Managed Agents and Google's Gemini Enterprise Agent Platform.

View details
54
Repo Health
66
Technical
77
Dependency
Built with
TypeScript 95%
Updated 1 months ago
Ruby
62%
BSD 3

Spree Commerce

CRM · Ecommerce · Marketing

15,774

Open-source headless eCommerce platform with a REST API, TypeScript SDK, and Next.js storefront for B2B, cross-border, and marketplace commerce — no vendor lock-in, no platform fees.

View details
91
Repo Health
84
Technical
75
Dependency
Built with
Ruby 62%
TypeScript 37%
Updated yesterday
TypeScript
92%
Other

Suna

AI Agents

20,306

Turn your company into a git repo — one config, one command center, a workforce of AI agents that runs the real work around the clock.

View details
90
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 92%
Updated today
TypeScript
99%
Other

Teable

Databases · No Code Platforms

21,920

A no-code PostgreSQL database with spreadsheet UX, real-time collaboration, and native AI agents — built for teams that outgrow Airtable.

View details
78
Repo Health
76
Technical
62
Dependency
Built with
TypeScript 99%
Updated yesterday
TypeScript
99%
AGPL 3.0

Webstudio

Design Tools · No Code Platforms

9,103

Open source visual development platform with complete CSS control, headless CMS integration, and full infrastructure ownership

View details
91
Repo Health
79
Technical
60
Dependency
Built with
TypeScript 99%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers