Package Exports
- ansi-html
- ansi-html/index.js
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 (ansi-html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ansi-html

An elegant lib that converts the chalked (ANSI) text to HTML.
Coverage
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