ansi-html
An elegant lib that converts the chalked (ANSI) text to HTML.
Last updated 3 years ago by tjatse .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ansi-html 
SYNC missed versions from official npm registry.

ansi-html NPM version Build Status

An elegant lib that converts the chalked (ANSI) text to HTML.

Coverage

  • All styles of chalk (100%) and colors.
  • There are over 150 randomized test cases under test.

Installation

$ npm install ansi-html

Usage

var ansiHTML = require('ansi-html');
var str = ansiHTML('[ANSI_TEXT]');

e.g.:

var chalk = require('chalk');

var str = chalk.bold.red('foo') + ' bar';
console.log('[ANSI]', str)
console.log('[HTML]', ansiHTML(str));

See complete examples under test / examples directory.

Set Colors

ansiHTML.setColors({
  reset: ['555', '666'], // FOREGROUND-COLOR or [FOREGROUND-COLOR] or [, BACKGROUND-COLOR] or [FOREGROUND-COLOR, BACKGROUND-COLOR]
  black: 'aaa',	// String
  red: 'bbb',
  green: 'ccc',
  yellow: 'ddd',
  blue: 'eee',
  magenta: 'fff',
  cyan: '999',
  lightgrey: '888',
  darkgrey: '777'
});

Reset

ansiHTML.reset();

Exposed Tags

var openTags = ansiHTML.tags.open;
var closeTags = ansiHTML.tags.close;

Test

$ npm install -l
$ npm test

Current Tags

  • 0.0.7                                ...           latest (3 years ago)

7 Versions

  • 0.0.7                                ...           3 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           4 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 191
This Week 2,615
This Month 249,810
Last Day 2,424
Last Week 28,404
Last Month 385,796
Dependencies (0)
None
Dev Dependencies (4)
Dependents (247)

Copyright 2014 - 2016 © taobao.org |