diff --git a/docs/modules/chalk.md b/docs/modules/chalk.md index 9f9e8e2..cd9b6c2 100644 --- a/docs/modules/chalk.md +++ b/docs/modules/chalk.md @@ -8,6 +8,9 @@ description: Modern alternatives to the chalk package for terminal string stylin Since Node 20.x, you can use the [`styleText`](https://nodejs.org/api/util.html#utilstyletextformat-text-options) function from the `node:util` module to style text in the terminal. +> [!TIP] +> Node.js provides a codemod which can migrate some of this automatically, see the docs at [@nodejs/chalk-to-util-styletext](https://app.codemod.com/registry/@nodejs/chalk-to-util-styletext) for more details. + Example: ```ts @@ -16,6 +19,8 @@ import chalk from 'chalk' // [!code --] console.log(`Hello ${chalk.blue('blue')} world!`) // [!code --] console.log(`Hello ${styleText('blue', 'blue')} world!`) // [!code ++] +console.log(`I am ${chalk.hex('#ec8f5e')('hex color')}!`) // [!code --] +console.log(`I am ${styleText('#ec8f5e', 'hex color')}!`) // [!code ++] ``` When using multiple styles, you can pass an array to `styleText`: @@ -26,7 +31,7 @@ console.log(`I am ${styleText(['blue', 'bgRed'], 'blue on red')}!`) // [!code ++ ``` > [!NOTE] -> `styleText` does not support RGB and hex colors (e.g. `#EFEFEF` or `255, 239, 235`). You can view the available styles in the [Node documentation](https://nodejs.org/api/util.html#modifiers). +> Before Node v26.1.0, `styleText` did not support hex colors or RGB colors (e.g. `#EFEFEF` or `255, 239, 235`). Hex colors are supported starting in v26.1.0, but RGB colors are still not supported. You can view the available styles in the [Node documentation](https://nodejs.org/api/util.html#modifiers). ## `picocolors` diff --git a/docs/modules/fetch.md b/docs/modules/fetch.md index 4034ab4..6afd640 100644 --- a/docs/modules/fetch.md +++ b/docs/modules/fetch.md @@ -10,6 +10,9 @@ This page contains the common, recommended alternatives and examples for fetch b The native [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) API is available in Node.js (since v18.x) and all modern browsers. For many use cases it replaces `axios`/`node-fetch`/`cross-fetch` without adding dependencies. +> [!TIP] +> Node.js provides a codemod which can migrate some of this automatically, see the docs at [@nodejs/axios-to-whatwg-fetch](https://app.codemod.com/registry/@nodejs/axios-to-whatwg-fetch) for more details. + Example: ```ts