ANSIS
lastmod 2025-05-23created 2025-05-231 edits
An ANSI color library usable in terminals, CI, and Chrome
Features
- A tiny, high-performance ANSI styling library that can replace (API-compatible) existing chalk, picocolors, colorette, etc.
- Supports both ESM and CJS, and is compatible with modern environments such as Next.js, Deno, and Bun
- Supports environment detection and automatic fallback: truecolor → 256 → 16 → monochrome
- Supports chaining and template literals for readable code: red.bold.underline('text')
- Supports various environment variables and CLI flags (NO_COLOR, FORCE_COLOR, --no-color)
- Handles line breaks without breaking styles mid-code (automatic styling across \n)
- Usable in terminals, CI environments, and Chromium-based browsers
- picocolors is fastest for a single style, but Ansis is fastest for two or more styles
- In real-world application environments (e.g., using combined styles), Ansis is faster than or equal to picocolors