# ansi-html

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

Latest version **0.0.9** (published 2022-03-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install ansi-html
pnpm add ansi-html
yarn add ansi-html
bun add ansi-html
```

Provides the command `ansi-html`.

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2022-03-01 |
| First published | 2014-12-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | separate (@types/ansi-html) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 110 |
| Author | Tjatse |
| Maintainers | tjatse |
| Keywords | ansi, ansi html, chalk html |

## Links

- npm: https://www.npmjs.com/package/ansi-html
- Repository: https://github.com/Tjatse/ansi-html
- Issues: https://github.com/Tjatse/ansi-html/issues
- npm.io page: https://npm.io/package/ansi-html

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2022-03-01
- 0.0.8 — 2022-02-28
- 0.0.7 — 2017-01-02
- 0.0.6 — 2016-10-26
- 0.0.5 — 2015-11-21
- 0.0.4 — 2014-12-16
- 0.0.3 — 2014-12-15
- 0.0.2 — 2014-12-15
- 0.0.1 — 2014-12-15

## README

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
```

---
_Source: https://npm.io/package/ansi-html · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
