picocolors

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

Library
npm
v1.1.1
1,745stars
ISC

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
40/100Fair
Development Activity0
Maintenance20
Community44
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture78
Code Quality80
Innovation82
Learning Curve90

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 23 apps in this directory

TypeScript
83%
Apache 2.0

agentmemory

AI Agents

27,166

Persistent memory for AI coding agents — built on the iii engine, it works across Claude Code, GitHub Copilot CLI, Cursor, Gemini CLI, Codex CLI, and any MCP client, so agents stop needing everything re-explained every session.

View details
81
Repo Health
69
Technical
81
Dependency
Built with
TypeScript83%
Updated 2 days ago
TypeScript
49%
AGPL 3.0

BrowserOS

Browser · AI Assistants

13,248

The open-source agentic Chromium browser with native AI agents, MCP server, and visual workflow automation — your data never leaves your machine.

View details
87
Repo Health
82
Technical
69
Dependency
Built with
TypeScript49%
Rust22%
Python16%
Updated today
TypeScript
99%
Apache 2.0

Bubble Lab

Automation · AI Development

1,095

Open-core workflow engine for building AI-powered automations in TypeScript that run natively inside Slack — no context switching required.

View details
35
Repo Health
78
Technical
72
Dependency
Built with
TypeScript99%
Updated 3 months ago
TypeScript
50%
Other

Dify

No Code Platforms · AI Development · Developer Tools

152,883

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

View details
92
Repo Health
85
Technical
71
Dependency
Built with
TypeScript50%
Python47%
Updated today
TypeScript
95%
Apache 2.0

Enclosed

Security

2,060

Send end-to-end encrypted notes and files where the server never sees your content — true zero-knowledge sharing.

View details
57
Repo Health
88
Technical
71
Dependency
Built with
TypeScript95%
Updated 5 days ago
TypeScript
93%
Apache 2.0

flue

AI Agents · Developer Tools

7,953

Build autonomous AI agents and powerful workflows with a programmable TypeScript harness that gives any model sessions, tools, sandboxes, and durable execution.

View details
67
Repo Health
82
Technical
75
Dependency
Built with
TypeScript93%
Updated 1 weeks ago
TypeScript
89%
Apache 2.0

HyperFrames

AI Development · AI Design Tools

41,625

Turn plain HTML and CSS into deterministic, pixel-perfect MP4 videos — authored by humans or AI agents, rendered by headless Chrome and FFmpeg.

View details
82
Repo Health
83
Technical
65
Dependency
Built with
TypeScript89%
Updated today
TypeScript
79%
LGPL 3.0

Latitude

AI Agents · Monitoring

4,593

Open-source AI agent monitoring that catches what will break next before your users do.

View details
86
Repo Health
88
Technical
67
Dependency
Built with
TypeScript79%
Python11%
Updated today
Python
51%
AGPL 3.0

LearnHouse

Learning Management · CMS

2,178

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

View details
89
Repo Health
77
Technical
67
Dependency
Built with
Python51%
TypeScript48%
Updated 3 days ago

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

Search