Skip to content

Commit

Permalink
doc: add colorText
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanth authored Jun 14, 2022
1 parent 7cd400f commit 9da85fe
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@ callbackFunction((err, ret) => {
});
```

## `util.colorText(format, text)`

<!-- YAML
added: v18.3.0
-->

* `format` {string} `format` one of the color format from `util.inspect.colors`
* `text` {string} The text you would like to color
* Returns: {string} colored text string

Takes `format` and `text` and retuns the colored text form

```js
const util = require('node:util');

console.log(util.colorText('red', 'This text shall be in red color'));
// ^ '\u001b[31mThis text shall be in red color\u001b[39m'
```

## `util.debuglog(section[, callback])`

<!-- YAML
Expand Down

0 comments on commit 9da85fe

Please sign in to comment.