No description or website provided.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin
lib
test
.gitattributes
.gitignore
README.md
package.json
version.txt

README.md

What's color-format

It can format output strings and make the console looks colorful.

Usage

Format strings

format has two arguments:

  • str --string to print to stdout.
  • opt --options like {fgc: 'red',bgc: 'yellow',eft: 'underline'}

    Options

  • fgc --foreground color(defalut 'white')
  • bgc --background color(defalut 'black')

you could use one of 'black','red','green','yellow','blue','magenta','cyan' or 'white'.

  • eft --effect (defalut 'reset').You could pass a string as 'underline' or an array as ['highlight', 'underline'].

you could use some of 'reset','highlight','dark','underline','flicker','inverse' or 'none'.

Example:

var format = require('color-format').format;
console.log(format('Hello world',{fgc:'red',bgc:'yellow',eft:'underline'}));

Warn function

Example:

var warn = require('color-format').warn;
warn('Hello world');

Error function

Example:

var error = require('color-format').error;
error('Hello world');

Notice function

Example:

var notice = require('color-format').notice;
notice('Hello world');

Info function

Example:

var info = require('color-format').info;
info('Hello world');

Command line support

format

usage: format string [options]

Options
  -f, --foreground  Set foreground color.
  -b, --background  Set background color.
  -v, --version     Print the version number and exit.
  -h, --help        Print help (this message) and exit.
  --er              effect reset
  --eh              effect highlight
  --ed              effect dark
  --eu              effect underline
  --ef              effect flicker
  --ei              effect inverse
  --en              effect none

Colors
  black            [  ][  ]
  red              [  ][  ]
  green            [  ][  ]
  yellow           [  ][  ]
  blue             [  ][  ]
  magenta          [  ][  ]
  cyan             [  ][  ]
  white            [  ][  ]