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

https://github.com/cakecatz/ansi-parser

Parser for string that include ansi codes.
https://github.com/cakecatz/ansi-parser

ansi-codes ansi-colors parser typescript

Last synced: about 1 month ago
JSON representation

Parser for string that include ansi codes.

Awesome Lists containing this project

README

        

# ansi-parser

Parser for string that include ansi codes.

## Install

```sh
npm i @cakecatz/ansi-parser
```

## Usage

```ts
const { parseAnsi } = require("@cakecatz/ansi-parser");
const cells = parseAnsi("\u001b[31mhello\u001b[39m");
```

`cells` will be like this.

```ts
[
{
bg: 0, // COLOR_CODES.BLACK
fg: 1, // COLOR_CODES.RED
content: "hello",
bold: false,
dim: false,
inverse: false,
italic: false,
underline: false
}
];
```