DeprecatedThis package is deprecated
Add CLI styles to text.
Features
24-Bit Colors (True Color)
Nested Styles
Supported Styles
Foreground Colors
Background Colors
Bold
Dim
Italic
Underline
Inverse
Strikethrough
Installation
Using npm
npm install @open-tech-world/es-cli-styles
Using Yarn
yarn add @open-tech-world/es-cli-styles
Usage
import { style } from '@open-tech-world/es-cli-styles';
style('~styleName[.styleName...]{Text}');
Examples
Using foreground color name
console.log(style('I like 🍊 ~orange{oranges}'))

Using multiple colors
console.log(style('An ~red{apple} is red but the ~green{leaves} are green, came in a blue ~blue{box}'))

Nested colors
console.log(style('~blue{This is a long blue text with some ~red{red} & ~green{green} color in it}'))

Composing different styles
console.log(style('~bold.white.bgGreen{ PASS }'))

Inverse colors
console.log(style('~inverse.red.bgWhite{ FAILED }'))

Faint, decreased intensity, or dim text
console.log(style('~dim{TEXT}'))

Italic fonts
console.log(style('~italic.fuchsia.bold.bgWhite{ Beautiful Text }'))

Underlined texts
console.log(style('Highlighted fruits: ~underline{Apple}, cat, ~underline{Banana}'))

Strikethrough text
console.log(style('~strike.red{Deleted file.ext}'))

Custom functions
function warning(str) {
return style(`⚠️ ~bold.black.bgYellow{${str}}`);
}
console.log(warning(' CAUTION '))

Style names
Foreground colors
- blue
- red
- green
- orange
- navy
- aqua
- teal
- purple
- fuchsia
- maroon
- yellow
- olive
- lime
- black
- gray
- silver
- white
Background colors
- bgBlue
- bgRed
- bgGreen
- bgOrange
- bgNavy
- bgAqua
- bgTeal
- bgPurple
- bgFuchsia
- bgMaroon
- bgYellow
- bgOlive
- bgLime
- bgBlack
- bgGray
- bgSilver
- bgWhite
rgb(red, green, blue)
bgRgb(red, green, blue)
Modifiers
- bold
- dim
- italic
- underline
- inverse
- strike
References
https://en.wikipedia.org/wiki/ANSI_escape_code
License
Copyright (c) 2021, Thanga Ganapathy (MIT License).