#tui #ascii #ansi-colors #parser #ansi

ansi-to-tui-forked

A library to convert ansi color coded text into ratatui::text::Text type from ratatui library

2 releases (1 unstable)

3.0.0-ratatui Mar 19, 2023
0.5.2-fix.offset May 4, 2022

#1009 in Command-line interface

MIT license

19KB
342 lines

ansi-to-tui

drone build github build downloads

A nom parser to parse text with ANSI color codes and turn them into ratatui::text::Text.

Color Supported Examples
24 bit \x1b[38;2;<R>;<G>;<B>m
8 bit \x1b[38;5;<N>m
4 bit \x1b[30..37;40..47m

Example

use ansi_to_tui::IntoText;
let buffer = std::fs::read("ascii/text.ascii").unwrap();
let output = buffer.into_text();

Dependencies

~8MB
~137K SLoC