kleur
Tiny (3.9kB), fast Node.js library for terminal string styling with ANSI colors. Drop-in alternative to chalk with a chainable API and automatic NO_COLOR/FORCE_COLOR environment variable support. Uses template literal tags and a chainable API. Notably faster than chalk in benchmarks and has zero dependencies.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Zero-dependency terminal coloring library — no security concerns.
⚡ Reliability
Best When
Building performance-sensitive Node.js CLI tools that need zero-dependency terminal coloring.
Avoid When
You're already using chalk or need tagged template literal syntax — chalk has better ecosystem support.
Use Cases
- • Add color and styling to Node.js CLI output with a zero-dependency, lightweight alternative to chalk
- • Style terminal output in performance-sensitive CLI tools where chalk's overhead is notable
- • Use as a chalk drop-in replacement in ESM projects without CommonJS compatibility issues
- • Apply multiple styles with chaining: kleur.bold().red().underline()('Error message')
- • Respect NO_COLOR environment variable automatically for accessible CLI tools
Not For
- • Complex template literal interpolation — chalk's tagged template literals (chalk`{red error}`) are more expressive
- • Browser environments — kleur uses ANSI escape codes which only work in terminals
- • Projects already using chalk where migration would be disruptive — chalk v5+ is ESM-first and well-maintained
Interface
Authentication
Library — no auth needed.
Pricing
MIT licensed open source library.
Agent Metadata
Known Gotchas
- ⚠ kleur v4 requires calling the function to get the string: kleur.red('text') — it's not a tagged template literal like chalk
- ⚠ Colors disabled by default when not in a TTY — set FORCE_COLOR=1 environment variable for piped output or CI environments
- ⚠ kleur is chainable but each chain link creates a new function call — store the style: const error = kleur.bold().red(); error('msg')
- ⚠ No support for chalk-style template literals ({red text}) — must use function call syntax: kleur.red('text')
- ⚠ Nested styles require explicit reset — mixing styles without proper closing may leak into surrounding output on some terminals
- ⚠ kleur uses CommonJS exports by default — in pure ESM projects, check the specific import syntax required
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for kleur.
Scores are editorial opinions as of 2026-03-06.