Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

node-style-text

fisker7.8kMIT0.0.7TypeScript support: included

Chainable util.styleText().

readme

node-style-text

Build Status Coverage Npm Version MIT License

Chainable util.styleText().

Install

yarn add node-style-text

Usage

import styleText from 'node-style-text'

console.log(styleText.blue.underline('Hello world!'))

Motivation

Provide convenience API.

- import {styleText} from 'node:utils'
+ import styleText from 'node-style-text'

console.log(
-   styleText('blue', 'Hello world!')
+   styleText.blue('Hello world!')
)

console.log(
-   styleText(['blue', 'underline'], 'Hello world!')
+   styleText.blue.underline('Hello world!')
)

API

styleText.<format>[.<format>...](string)

Example: styleText.red.bold.underline('Hello', 'world');

Available formats: util.inspect.colors