Skip to content

Commit 04fb145

Browse files
authored
doc: clarify hex code usage in styleText docs
Signed-off-by: Chris Swithinbank <swithinbank@gmail.com> PR-URL: #66539 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent 4599b6a commit 04fb145

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎doc/api/util.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,9 +2822,8 @@ changes:
28222822
such as NO_COLOR, NODE_DISABLE_COLORS, and FORCE_COLOR.
28232823
-->
28242824
2825-
* `format` {string | Array} A text format or an Array
2826-
of text formats defined in `util.inspect.colors`, or a hex color in `#RGB`
2827-
or `#RRGGBB` form.
2825+
* `format` {string | Array} A text format defined in `util.inspect.colors`,
2826+
a hex color in `#RGB` or `#RRGGBB` form, or an Array of text formats and/or hex colors.
28282827
* `text` {string} The text to be formatted.
28292828
* `options` {Object}
28302829
* `validateStream` {boolean} When true, `stream` is checked to see if it can handle colors. **Default:** `true`.
@@ -2899,6 +2898,9 @@ console.log(styleText('#ff5733', 'Orange text'));
28992898

29002899
// 3-digit hex color (shorthand)
29012900
console.log(styleText('#f00', 'Red text'));
2901+
2902+
// Hex color combined with other modifiers
2903+
console.log(styleText(['#00f', 'bold'], 'Bold blue text'));
29022904
```
29032905
29042906
```cjs
@@ -2909,6 +2911,9 @@ console.log(styleText('#ff5733', 'Orange text'));
29092911

29102912
// 3-digit hex color (shorthand)
29112913
console.log(styleText('#f00', 'Red text'));
2914+
2915+
// Hex color combined with other modifiers
2916+
console.log(styleText(['#00f', 'bold'], 'Bold blue text'));
29122917
```
29132918
29142919
The full list of formats can be found in [modifiers][].

0 commit comments

Comments
 (0)