3.0.0 • Published 6 years ago
@nxmix/tokenize-ansi v3.0.0
tokenize-ansi
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!