Giter VIP home page Giter VIP logo

colorize-node's Introduction

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 colors Background colors Modifiers
black bgBlack reset
red bgRed bold
green bgGreen italic
yellow bgYellow underline
blue bgBlue strikethrough
magenta bgMagenta hidden
cyan bgCyan dim
white bgWhite overlined
gray bgGray blink
redBright bgRedBright inverse
greenBright bgGreenBright doubleunderline
yellowBright bgYellowBright framed
blueBright bgBlueBright
magentaBright bgMagentaBright
cyanBright bgCyanBright
whiteBright bgWhiteBright

License

This project is under MIT license.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.