JSPM

fuzzy-ansi-color

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 24
  • Score
    100M100P100Q70091F
  • License MIT

compute ansi color modes fuzzily with strings

Package Exports

  • fuzzy-ansi-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 (fuzzy-ansi-color) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fuzzy-ansi-color

compute ansi color modes fuzzily with strings

example

var colorize = require('fuzzy-ansi-color');
process.stdout.write(Buffer.concat([
    colorize('bright cyan'), 
    Buffer('hello '),
    colorize('bg dim #c540a0 fg bright yellow'),
    Buffer('world\n'),
    colorize('reset')
]));

syntax

The syntax is a string that gets split on whitespace into an array of commands.

Use a named color to set a color by its name.

Use /^#[0-9a-f]{6}/ to set the color with a hex code.

Use rgb(\d+,\d+,\d+) to set the color with an rgb code with values from 0 through 255, inclusive.

If you pass in an array for one of the parts, it will be treated as an rgb code.

Set the mode with:

  • bright
  • dim
  • underscore
  • blink
  • reverse
  • hidden

Control whether to set the foreground or background mode with:

  • fg
  • bg

Use the string reset to reset the color and mode.

methods

var colorize = require('fuzzy-ansi-color')

var buf = colorize(s)

Turn a string or array s into a colorized buffer buf.

install

With npm do:

npm install fuzzy-ansi-color

license

MIT