npm.io
0.0.6 • Published 8 years ago

colors-md

Licence
GPL-3.0
Version
0.0.6
Deps
0
Size
84 kB
Vulns
0
Weekly
0

Description

A NodeJS module that returns terminal escape codes for styling strings.
Colors-md can convert to ansi8 and ansi256 color codes.
Currently accepts hex and rgb color input strings.

Installation

Local
[sudo] npm install --save colors-md
Global
[sudo] npm install --global colors-md

Usage

Color Format Specification
Hex
  • '#ffffff'
  • 'ffffff'
  • '#fff'
  • 'fff'
RGB
  • '255, 255, 255'
  • '255 255 255'
Code
const colors = require('colors-md');

console.log(colors.ansi8.hex('#ff0000') + 'text' + colors.reset);
console.log(colors.ansi256.hex('0f0') + 'text' + colors.reset);

console.log(colors.ansi8.rgb('0, 0, 255') + 'text' + colors.reset);
console.log(colors.ansi256.rgb('255 255 255') + 'text' + colors.reset);

Keywords