talira

Terminal string styling for Node.js: colours, backgrounds and text styles

open sourceMITfree

Chalk styles strings for the terminal in Node.js with a chainable API: colours, background colours and modifiers such as bold and underline, nested as deep as needed. It auto-detects the terminal's colour support, supports 256 colours and Truecolor, has no dependencies and doesn't extend String.prototype.

Problems it solves

  • Print coloured and bold text to the terminal from my Node.js CLI
  • Style console output in Node and fall back when the terminal has no colour support
  • Highlight errors in red and successes in green in my JavaScript command-line tool output

Features

  • Chainable and nestable styles
  • 256-colour and Truecolor support
  • Auto-detects colour support
  • No dependencies

Limitations

  • Chalk 5 and later are ESM only; CommonJS projects stay on Chalk 41

Capabilities

Has an APIplan not known

Alternatives

The same job

These do what Chalk does.

  1. colors.js Colours and styles for Node.js console output (npm package colors)
  2. strip-ansi Strip ANSI escape codes from a string
  3. Ink React for interactive command-line apps

Compare Chalk with the top 3