parse-color-ansi

0.0.1 • Public • Published

ansi-color-parse

Usage

npm install ansi-color-parse

const {parseAnsi, ansi2html, parseHtml} = require('ansi-color-parse');

const str = "\u001b[34mHello\u001b[39m World\u001b[31m!\u001b[39m";

const parseList = parseAnsi(str);

console.log(parseList);
// [ { foreground: 'blue', text: 'Hello' },
//   { text: ' World' },
//   { foreground: 'red', text: '!' } ]

console.log(ansi2html(parseList));
// <span class="blue">Hello</span><span> World</span><span class="red">!</span>

console.log(parseHtml(str));
//<span class="blue">Hello</span><span> World</span><span class="red">!</span>

License

MIT

Copyright (c) 2018 蓝色的秋风

Readme

Keywords

none

Package Sidebar

Install

npm i parse-color-ansi

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

26.3 kB

Total Files

12

Last publish

Collaborators

  • sounder