Chalk

Terminal string styling library for Node.js. Chalk provides a chainable API for adding colors, bold, italic, underline, and background colors to terminal output. Handles terminal color support detection automatically — no color output in non-TTY environments unless forced. The most popular terminal styling library for Node.js CLI tools. Chalk 5+ is ESM-only.

Evaluated Mar 06, 2026 (0d ago) v5+
Homepage ↗ Repo ↗ Developer Tools terminal colors styling cli node sindresorhus
⚙ Agent Friendliness
70
/ 100
Can an agent use this?
🔒 Security
90
/ 100
Is it safe for agents?
⚡ Reliability
86
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
92
Error Messages
85
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
90
Auth Strength
90
Scope Granularity
90
Dep. Hygiene
90
Secret Handling
88

String styling only — no security concerns. Don't use styled strings to mask sensitive output from logging.

⚡ Reliability

Uptime/SLA
92
Version Stability
85
Breaking Changes
78
Error Recovery
88
AF Security Reliability

Best When

You need simple, reliable terminal color and style output in Node.js CLI tools — Chalk is the industry standard.

Avoid When

You need complex terminal UI components (tables, spinners, progress bars) — use specialized libraries. For colors-only, kleur or picocolors are lighter alternatives.

Use Cases

  • Add color coding to CLI output for better readability — success in green, errors in red, warnings in yellow
  • Style terminal output in agent CLI tools to make status information visually clear
  • Build colored progress indicators and status messages in Node.js automation scripts
  • Highlight important output sections in development tool output
  • Apply consistent terminal styling across a CLI application's output

Not For

  • Browser console styling — use native console color format codes for browser
  • Complex terminal UI with boxes, tables, or layouts — use cli-table3, boxen, or ink for richer terminal UIs
  • Non-terminal environments — Chalk detects non-TTY and strips colors by default

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — string styling library.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

MIT-licensed Sindre Sorhus open source project.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Chalk v5 is ESM-only — CommonJS require('chalk') no longer works; use import or stay on chalk v4 for CommonJS projects
  • Colors are disabled in non-TTY environments by default — CI environments, pipe output, and file redirects strip all ANSI codes; use FORCE_COLOR=1 to override
  • Template literal syntax (chalk.red`text`) is different from method syntax (chalk.red('text')) — both work but can't be mixed in same expression
  • Chalk trusts terminal color level detection — may incorrectly detect color support for some terminal emulators; configure chalk.level manually if detection is wrong
  • Nesting chalk styles can produce unexpected results — chalk.red(chalk.bold('text')) vs chalk.red.bold('text') may produce different output in some terminals
  • kleur and picocolors are faster, smaller alternatives — if bundle size or performance is critical and you need basic colors only, consider these lighter options

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Chalk.

$99

Scores are editorial opinions as of 2026-03-06.

5211
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered