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
98%
Other

LobeHub

AI Assistants · Automation · Productivity

83,455

Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.

View details
92
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 98%
Updated today
Clojure
71%
AGPL 3.0

Logseq

Knowledge Management · Note Taking

45,349

A privacy-first, open-source knowledge graph platform combining Markdown, Org-mode, bidirectional linking, and local-first storage for building your second brain.

View details
92
Repo Health
82
Technical
65
Dependency
Built with
Clojure 71%
OCaml 12%
Updated yesterday
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

29,041

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
90
Repo Health
73
Technical
65
Dependency
Built with
TypeScript 99%
Updated today
TypeScript
87%
MIT

medusa

Ecommerce

36,897

The most flexible open-source commerce platform — build B2C, B2B, and marketplace applications with modular, composable commerce primitives.

View details
94
Repo Health
87
Technical
63
Dependency
Built with
TypeScript 87%
JavaScript 12%
Updated yesterday
TypeScript
92%
Other

n8n

Automation · No Code Platforms

208,437

Code when you need it, UI when you don't — the workflow automation platform built for technical teams who refuse to choose.

View details
95
Repo Health
87
Technical
62
Dependency
Built with
TypeScript 92%
Updated yesterday
TypeScript
99%
Other

NocoBase

Low Code Platforms · No Code Platforms

24,686

Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 99%
Updated today
TypeScript
98%
Other

Novu

Developer Tools

40,195

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated today
TypeScript
97%
GPL 3.0

OpenKnowledge

Code Editors · Knowledge Management · Note Taking

4,674

A beautiful, local-first markdown IDE that turns any git repo into a live collaborative workspace for humans and AI coding agents like Claude, Codex, and OpenCode.

View details
80
Repo Health
89
Technical
64
Dependency
Built with
TypeScript 97%
Updated today
TypeScript
93%
MIT

paperclip

AI Agents · Automation

106,667

The open-source control plane that turns a pile of AI agents into an actual company — with org charts, budgets, heartbeats, and governance.

View details
86
Repo Health
78
Technical
68
Dependency
Built with
TypeScript 93%
Updated today

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