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.
- Host: GitHub
- URL: https://github.com/cakecatz/ansi-parser
- Owner: cakecatz
- Created: 2019-11-29T04:52:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T02:19:30.000Z (over 2 years ago)
- Last Synced: 2025-03-12T07:55:46.879Z (2 months ago)
- Topics: ansi-codes, ansi-colors, parser, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@cakecatz/ansi-parser
- Size: 1.29 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
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
}
];
```