Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/modules/chalk.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`:
Expand All @@ -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`

Expand Down
3 changes: 3 additions & 0 deletions docs/modules/fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading