source: trip-planner-front/node_modules/ansi-html/README.md@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1ansi-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)
2=========
3An elegant lib that converts the chalked (ANSI) text to HTML.
4
5# Coverage
6- All styles of [chalk](https://github.com/sindresorhus/chalk) (100%) and [colors](https://github.com/Marak/colors.js).
7- There are over **150** randomized test cases under `test`.
8
9# Installation
10```
11$ npm install ansi-html
12```
13
14# Usage
15```javascript
16var ansiHTML = require('ansi-html');
17var str = ansiHTML('[ANSI_TEXT]');
18```
19
20e.g.:
21```javascript
22var chalk = require('chalk');
23
24var str = chalk.bold.red('foo') + ' bar';
25console.log('[ANSI]', str)
26console.log('[HTML]', ansiHTML(str));
27```
28
29See complete examples under `test` / `examples` directory.
30
31# Set Colors
32```javascript
33ansiHTML.setColors({
34 reset: ['555', '666'], // FOREGROUND-COLOR or [FOREGROUND-COLOR] or [, BACKGROUND-COLOR] or [FOREGROUND-COLOR, BACKGROUND-COLOR]
35 black: 'aaa', // String
36 red: 'bbb',
37 green: 'ccc',
38 yellow: 'ddd',
39 blue: 'eee',
40 magenta: 'fff',
41 cyan: '999',
42 lightgrey: '888',
43 darkgrey: '777'
44});
45```
46
47# Reset
48```javascript
49ansiHTML.reset();
50```
51
52# Exposed Tags
53```javascript
54var openTags = ansiHTML.tags.open;
55var closeTags = ansiHTML.tags.close;
56```
57
58# Test
59```
60$ npm install -l
61$ npm test
62```
Note: See TracBrowser for help on using the repository browser.