An open API service indexing awesome lists of open source software.

https://github.com/smallhelm/ansi-style-parser

Parse ansi colors and styles
https://github.com/smallhelm/ansi-style-parser

Last synced: 10 months ago
JSON representation

Parse ansi colors and styles

Awesome Lists containing this project

README

          

# ansi-style-parser

Parse ANSI colors and styles

## Install
`npm install ansi-style-parser`

## Usage

```js
var c = require('chalk');
var parser = require('ansi-style-parser');

var txt = 'Some ';
txt += c.bold.green('styled ' + c.underline.bgBlack('text') + c.red('!'));

console.log(parser(txt));
```
Output:
```js
[ { styles: [],
text: 'Some ' },

{ styles: [ 'bold', 'green' ],
text: 'styled ' },

{ styles: [ 'bold', 'green', 'underline', 'bgBlack' ],
text: 'text' },

{ styles: [ 'bold', 'red' ],
text: '!' } ]
```

## License
MIT