#ansi #ascii #tui #parser

ansi-to-tui

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

17 releases (3 major breaking)

new 3.0.0 Mar 21, 2023
2.0.2 Mar 21, 2023
2.0.0 Sep 17, 2022
1.0.1 Jul 20, 2022
0.3.0 Jun 1, 2021

#111 in Text processing

Download history 402/week @ 2022-12-02 374/week @ 2022-12-09 331/week @ 2022-12-16 308/week @ 2022-12-23 276/week @ 2022-12-30 544/week @ 2023-01-06 416/week @ 2023-01-13 402/week @ 2023-01-20 616/week @ 2023-01-27 468/week @ 2023-02-03 448/week @ 2023-02-10 434/week @ 2023-02-17 405/week @ 2023-02-24 387/week @ 2023-03-03 414/week @ 2023-03-10 389/week @ 2023-03-17

1,665 downloads per month
Used in 5 crates

MIT license

19KB
346 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.

For people still using tui-rs use version v2.* for people migrating to ratatui use version v3.* I recommend switching over to ratatui since tui-rs is currently unmaintained.

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

~3MB
~67K SLoC