Amazing CLIfor Terminal
← All Documentation

Release Notes

Git2Docs Certified

This is the initial release of chalk, an ESM-only Node.js library for styling terminal output with ANSI escape sequences. It provides automatic color-level detection and a chainable API for composing text styles such as colors, backgrounds, and formatting modifiers.

New features

  • Chainable styling API
    Style terminal strings by chaining modifiers such as `chalk.bold.red('Hello')` or `chalk.bgBlue.white.underline('World')`. Multiple styles can be composed fluently in a single expression.
  • Foreground and background colors
    Apply standard colors (black, red, green, yellow, blue, magenta, cyan, white, gray/grey), bright variants, and their background equivalents (e.g., `chalk.bgRed`, `chalk.bgBrightCyan`) to terminal output.
  • Text modifiers
    Apply formatting modifiers including `bold`, `dim`, `italic`, `underline`, `overline`, `inverse`, `hidden`, and `strikethrough` to styled strings.
  • 256-color and Truecolor (16 million colors) support
    Use `chalk.ansi256(n)` and `chalk.bgAnsi256(n)` for 256-color mode, or `chalk.rgb(r, g, b)` / `chalk.bgRgb(r, g, b)` and `chalk.hex('#RRGGBB')` / `chalk.bgHex('#RRGGBB')` for full Truecolor support.
  • Automatic color-level detection
    Chalk automatically detects the terminal's supported color level (none, basic, 256-color, or Truecolor) and gracefully degrades output when the environment supports fewer colors.
  • Configurable color level
    Override the detected color level by instantiating a custom Chalk instance: `new Chalk({ level: 2 })`. Level 0 disables all styling, 1 enables basic colors, 2 enables 256 colors, and 3 enables Truecolor.
  • Tagged template literal support
    Use Chalk as a tagged template literal for inline styling: `` chalk`Hello {bold world}` ``.
  • ESM-only distribution
    Chalk is published as a pure ES module, enabling tree-shaking and compatibility with modern ESM-based toolchains. Import it with `import chalk from 'chalk'`.