Release Notes
Git2Docs CertifiedThis 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 APIStyle 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 colorsApply 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 modifiersApply formatting modifiers including `bold`, `dim`, `italic`, `underline`, `overline`, `inverse`, `hidden`, and `strikethrough` to styled strings.
- 256-color and Truecolor (16 million colors) supportUse `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 detectionChalk 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 levelOverride 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 supportUse Chalk as a tagged template literal for inline styling: `` chalk`Hello {bold world}` ``.
- ESM-only distributionChalk is published as a pure ES module, enabling tree-shaking and compatibility with modern ESM-based toolchains. Import it with `import chalk from 'chalk'`.