1.0.1 • Published 6 months ago

colorize-node v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

colorize-node

npm node-current npm package minimized gzipped size (select exports)

A lightweight library to color Node.js terminal output.

  • ✅ Zero dependencies
  • ✅ TypeScript support
  • ✅ Node.js v18.12.0+ support
  • 3x smaller then picocolors

Installation

npm install --save-dev colorize-node

Usage

// use named export, no default export
import { colorize } from 'colorize-node'

colorize.red('This string is red')

colorize.green(colorize.bold('This string is green & bold'))

colorize.bgGreen(`This string has green background and ${colorize.bold('this string is bold')}`)

Supported colors

Uses modifiers, foreground & background colors from nodes util.inspect.colors.

Taken from the Node.js docs:

Foreground colorsBackground colorsModifiers
blackbgBlackreset
redbgRedbold
greenbgGreenitalic
yellowbgYellowunderline
bluebgBluestrikethrough
magentabgMagentahidden
cyanbgCyandim
whitebgWhiteoverlined
graybgGrayblink
redBrightbgRedBrightinverse
greenBrightbgGreenBrightdoubleunderline
yellowBrightbgYellowBrightframed
blueBrightbgBlueBright
magentaBrightbgMagentaBright
cyanBrightbgCyanBright
whiteBrightbgWhiteBright

License

Licensed under the MIT license.

The colorize.test.ts file bundles portions of picocolors (ISC License).