Sha256: 53b1604c716739b4ee6da7f961b040f4e109bc12015c29dc82d63b33be8ac3f7

Contents?: true

Size: 1.36 KB

Versions: 33

Compression:

Stored size: 1.36 KB

Contents

ansi-html [![NPM version](https://badge.fury.io/js/ansi-html.svg)](http://badge.fury.io/js/ansi-html) [![Build Status](https://travis-ci.org/Tjatse/ansi-html.svg?branch=master)](https://travis-ci.org/Tjatse/ansi-html)
=========
An elegant lib that converts the chalked (ANSI) text to HTML.

# Coverage
- All styles of [chalk](https://github.com/sindresorhus/chalk) (100%) and [colors](https://github.com/Marak/colors.js).
- There are over **150** randomized test cases under `test`.

# Installation
```
$ npm install ansi-html
```

# Usage
```javascript
var ansiHTML = require('ansi-html');
var str = ansiHTML('[ANSI_TEXT]');
```

e.g.:
```javascript
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
```javascript
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
```javascript
ansiHTML.reset();
```

# Exposed Tags
```javascript
var openTags = ansiHTML.tags.open;
var closeTags = ansiHTML.tags.close;
```

# Test
```
$ npm install -l
$ npm test
```

Version data entries

33 entries across 32 versions & 11 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/ansi-html/README.md
disco_app-0.18.0 test/dummy/node_modules/ansi-html/README.md
disco_app-0.18.2 test/dummy/node_modules/ansi-html/README.md
disco_app-0.16.1 test/dummy/node_modules/ansi-html/README.md
disco_app-0.15.2 test/dummy/node_modules/ansi-html/README.md
disco_app-0.18.4 test/dummy/node_modules/ansi-html/README.md
disco_app-0.18.1 test/dummy/node_modules/ansi-html/README.md
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/ansi-html/README.md
disco_app-0.14.0 test/dummy/node_modules/ansi-html/README.md
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/ansi-html/README.md
tang-0.2.1 spec/tang_app/node_modules/ansi-html/README.md
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/ansi-html/README.md
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/ansi-html/README.md
ruby2js-4.0.4 lib/tasks/testrails/node_modules/ansi-html/README.md
ruby2js-4.0.3 lib/tasks/testrails/node_modules/ansi-html/README.md
tang-0.2.0 spec/tang_app/node_modules/ansi-html/README.md
tang-0.1.0 spec/tang_app/node_modules/ansi-html/README.md
tang-0.0.9 spec/tang_app/node_modules/ansi-html/README.md
enju_library-0.3.8 spec/dummy/node_modules/ansi-html/README.md
ilog-0.4.1 node_modules/ansi-html/README.md