API Reference
picocolors
A tiny, dependency-free terminal color library that detects color support and exposes stylers.
Official Documentation ↗CompatibilityThis documentation covers version
v1.0. Check the official docs for the latest API surface.Installation
npm
npm install picocolorsMethods
No methods match this filter.
picocolors provides color and style functions that become no-ops when the terminal lacks support.
Key Features
- 2.6 kB, zero dependencies
- Automatic color support detection
- Chained styles via a single import
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
FAQ
- How is it so small?
- It ships only the escape codes and a check for color support, leaving out the chaining proxy and theme objects larger libraries provide.
- Why is my output colorless in CI?
- Color support is disabled when output is not a TTY or NO_COLOR is set, which keeps logs clean. Force it with FORCE_COLOR.
- Can I nest styles?
- Yes. Compose calls such as pc.bold(pc.red(text)); the inner style is applied first and both codes are emitted.
Report a problem with this API docOpens a pre-filled issue on GitHub.