Skip to content

Update dependency chalk to v5

renovate-bot requested to merge renovate/chalk-5.x into develop

This MR contains the following updates:

Package Type Update Change
chalk devDependencies major 1.1.3 -> 5.0.1

Release Notes



Compare Source

  • Add main field to package.json for backwards compatibility with some developer tools 85f7e96


Compare Source

  • This package is now pure ESM. Please read this.
    • If you use TypeScript, you need to use TypeScript 4.7 or later. Why.
    • If you use a bundler, make sure it supports ESM and that you have correctly configured it for ESM.
    • The Chalk issue tracker is not a support channel for your favorite build/bundler tool.
    • It's totally fine to stay on Chalk v4. It's been stable for years.
  • Require Node.js 12.20 fa16f4e
  • Move some properties off the default export to individual named exports:
    • chalk.InstanceChalk
    • chalk.supportsColorsupportsColor
    • chalk.stderrchalkStderr
    • chalk.stderr.supportsColorsupportsColorStderr
  • Remove .keyword(), .hsl(), .hsv(), .hwb(), and .ansi() coloring methods (#​433) 4cf2e40
    • These were not commonly used and added a lot of bloat to Chalk. You can achieve the same by using the color-convert package.
  • The tagged template literal support moved into a separate package: chalk-template (#​524) c987c61
-import chalk from 'chalk';
+import chalkTemplate from 'chalk-template';

-chalk`2 + 3 = {bold ${2 + 3}}`;
+chalkTemplate`2 + 3 = {bold ${2 + 3}}`;


Compare Source

  • Readme updates


Compare Source


Compare Source


Compare Source

  • Require Node.js 10 61999a4
  • Change the Level TypeScript type to be a union instead of enum f0f4638
-if (chalk.level > Level.None) {}
+if (chalk.level > 0) {}
  • Use Object.setPrototypeOf as __proto__ could potentially be disabled (#​387) 63469d3


Compare Source

This release has been in development for more than a year and massively improves performance and the time it takes to import Chalk.

Thanks to @​stroncium for his hard work on this. 🙌

  • Require Node.js 8 3ef170b
  • Remove the .enabled property in favor of .level (#​356) 1f77953
    • Why: It was confusing to users to have two properties for detecting color support.
    • Migrate:
-if (chalk.enabled) {}
+if (chalk.level > 0) {}
  • Remove chalk.constructor() in favor of chalk.Instance() (#​322) de2f4cd
    • Migrate:
-new chalk.constructor({level: 1});
+new chalk.Instance({level: 1})
Minor breaking
-import chalk from 'chalk';
+import chalk = require('chalk');
  • Drop built-in Flow type definition d3be9c6
    • Why: None of us use Flow and we were not good at maintaining the type definition. You can get the types at flow-typed (needs to be updated to Chalk v3, open an issue on flow-typed).
  • Rename the ChalkOptions TypeScript type to Options cf66156
  • Remove dim style workaround for Windows (#​331) cd5de7a
    • Why: The issue was fixed in newer Windows 10 builds.
  • Remove the blue color workaround for Windows (#​330) 2ca015c
    • Why: The issue was fixed in newer Windows 10 builds.
Color detection
  • Fix support for nested styles (#​335) 87156ce
  • Fix const enum for TypeScript (#​364) 4e65299
  • Fix TypeScript type for supportsColor which is top‑level only (#​342) b3e9b91
  • Fix TypeScript type for chalk.supportsColor (#​347) d82b2a6
  • Fix TypeScript type for tagged template literal argument to accept unknown instead of just string (#​316) 7f6e563


Compare Source

This release is done from the v2-release branch, as master branch targets the work-in-progress v3 release.


Compare Source

  • Improved Flow type definition for CommonJS interop.


Compare Source


Compare Source


Compare Source


Compare Source


Compare Source


Compare Source

Chalk now comes with TypeScript type definitions built-in. Note: It's incompatible with @types/chalk if you're currently using that:


Compare Source


Compare Source


Compare Source

version 2

Chalk is a Node.js module for styling and colorizing terminal output.

Two years ago, @​qix- asked me about adding 256/Truecolor support to Chalk. He soon after joined the Chalk team. And now we’re finally able to ship Truecolor support in Chalk!

Chalk has had an immense growth since the 1.0.0 release in 2015. It's now trusted by more than 17.000 packages, up from 3000, and it's the 5th most depended upon package on npm.


Breaking changes
256/Truecolor support

chalk rainbow

Chalk now supports 256 colors and Truecolor (16 million colors). Terminal apps like Hyper and iTerm supports Truecolor, enabling you to create really immersive CLI experiences. Chalk is smart enough to downsample the colors to whatever the terminal supports, so you can use any colors without having to think whether it's supported or not.

Read more in the docs.

Tagged template literal

Chalk now ships with a tagged template literal that makes it much nicer to create long strings with lots of different styling.

const name = 'Sindre';
console.log(chalk`{bold Hello ${name}}`);

Read more in the docs.


All changes

Made with by Josh, Sindre, and all our wonderful contributors.


📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this MR and you won't be reminded about this update again.

  • If you want to rebase/retry this MR, click this checkbox.

This MR has been generated by Renovate Bot.

Edited by renovate-bot

Merge request reports