🛠️
Utility60M+/wkISC

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
npm install picocolors
yarn
yarn add picocolors
pnpm
pnpm add picocolors

Import

ESM
import pc from 'picocolors';

Quick Example

usage
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

Packagepicocolors
CategoryUtility
Weekly Downloads60M+
LicenseISC
Installnpm install picocolors

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.