3.0.0 • Published 6 years ago

@nxmix/tokenize-ansi v3.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

tokenize-ansi

styled with prettier Build Status Coverage Status npm Greenkeeper badge

tokenize a string that includes ansi code.

Usage

install

npm install @nxmix/tokenize-ansi

example

import tokenize from '@nxmix/tokenize-ansi'

tokenize("\x1b1A");
// => [ ["up", 1] ], cursor moves up one line

tokenize("\x1b31m" + "a");
// => [ ["red"], ["text", "a"] ], red text

tokenize("\x1b38;2;123,45,67m" + "a");
// => [ ["moreColor", 2, 123, 45, 67], ["text", "a"] ], true-color text

tokenize("\x1b25h");
// => [ ["cursor-on"] ], show cursor

This project follows the all-contributors specification. Contributions of any kind are welcome!