picocolors
picocolors is the smallest and fastest library for adding colors to terminal output, providing a lightweight alternative to chalk with a simpler API. At just 0.…
Installation
npm install picocolors
yarn add picocolors
pnpm add picocolors
Import
import pc from 'picocolors';
Quick Example
import pc from 'picocolors';
console.log(pc.red('Error: ') + 'Something went wrong');
console.log(pc.green('✓ ') + pc.bold('Tests passed'));
console.log(pc.bgBlue(pc.white(' INFO ')) + ' Processing...');About picocolors
picocolors is the smallest and fastest library for adding colors to terminal output, providing a lightweight alternative to chalk with a simpler API. At just 0.1KB, picocolors is approximately 14x smaller than chalk and 2x faster, making it ideal for libraries and tools where dependency size and startup performance matter. The library provides basic color functions (red, green, blue, yellow, cyan, magenta, white, gray, black), background colors (bgRed, bgGreen, etc.), and modifiers (bold, italic, dim, underline, strikethrough, inverse, hidden, reset). Unlike chalk's chaining API, picocolors uses function nesting: pc.bold(pc.red('Error')). The library automatically detects color support using the same environment variable conventions as chalk (NO_COLOR, FORCE_COLOR, CI detection) and disables colors when output is piped. picocolors has become the preferred choice for library authors who want to provide colored output without adding a heavy dependency — it is used by PostCSS, Vite, ESLint, Rollup, and many other tools that previously used chalk. For applications where chalk's advanced features (hex colors, RGB, template literals) are not needed, picocolors provides the essential functionality with minimal overhead.
Quick Facts
| Package | picocolors |
| Category | Utility |
| Weekly Downloads | 60M+ |
| License | ISC |
| Install | npm install picocolors |
Related Packages
Chalk is the most popular library for styling terminal string output with colors and formatting in N…
Ora is an elegant terminal spinner library for Node.js that provides visual feedback during long-run…
Commander is the most popular library for building command-line interfaces in Node.js, providing a f…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.