ansi-html-community (0.0.8)
Published 2026-02-24 13:52:42 +00:00 by atheaadmin
Installation
registry=npm install ansi-html-community@0.0.8"ansi-html-community": "0.0.8"About this package
ansi-html

An elegant lib that converts the chalked (ANSI) text to HTML.
Coverage
Installation
$ npm install ansi-html-community
Usage
var ansiHTML = require('ansi-html-community');
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
Dependencies
Development Dependencies
| ID | Version |
|---|---|
| chai | ^1.9.1 |
| chalk | ^1.1.3 |
| lodash | ^2.4.2 |
| mocha | ^1.21.4 |
Keywords
ansi
ansi html
chalk html