color-format

1.0.2 • Public • Published

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('format').format;
console.log(format('Hello world',{fgc:'red',bgc:'yellow',eft:'underline'}));

Warn function

Example:

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

Error function

Example:

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

Notice function

Example:

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

Info function

Example:

var info = require('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            [  ][  ]

Readme

Keywords

none

Package Sidebar

Install

npm i color-format

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • jerry-nil