JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3629522
  • Score
    100M100P100Q184535F

Colors and formatting for the console

Package Exports

  • cli-color

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-color) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cli-color - Yet another console color package.

What's wrong with the others ?
Awesome ones mess with built-ins, less awesome seem too verbose in use. This one aims to be both safe and neat.

Installation

$ npm install cli-color

Usage

Usage:

var ccolor = require('cli-color');

Output colored text:

color.log(ccolor.red('Text in red'));

Styles can be mixed:

color.log(ccolor.red.bgWhite.underline('Underlined red text on white background.'));

Styled text can be mixed with unstyled:

ccolor.log(ccolor.red('red') + ' plain ' + ccolor.blue('blue'));

Best way is to preset needed stylings and then use it:

var error = ccolor.red.bold;
var warn = ccolor.yellow;
var notice = ccolor.blue;

console.log(error('Error!'));
console.log(warn('Warning'));
console.log(notice('Notice'));

Supported are all ANSI colors and styles:

Styles

Styles will display correctly if font used in your console supports them.

  • bold
  • italic
  • underline
  • inverse
  • strike

Foreground colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white

Background colors

  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgMagenta
  • bgCyan
  • bgWhite