#tui #ansi-colors #text-parser #ansi #text-color #convert-text #ansi-term

ansi-to-tui

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

25 releases (7 major breaking)

7.0.0 Oct 25, 2024
6.0.1 Oct 24, 2024
6.0.0 Sep 3, 2024
5.0.0-rc.1 Jul 11, 2024
0.3.0 Jun 1, 2021

#26 in Command-line interface

Download history 3536/week @ 2024-07-31 3308/week @ 2024-08-07 5999/week @ 2024-08-14 6022/week @ 2024-08-21 7235/week @ 2024-08-28 7535/week @ 2024-09-04 8393/week @ 2024-09-11 5940/week @ 2024-09-18 6155/week @ 2024-09-25 5638/week @ 2024-10-02 4995/week @ 2024-10-09 4422/week @ 2024-10-16 5680/week @ 2024-10-23 5361/week @ 2024-10-30 4324/week @ 2024-11-06 4078/week @ 2024-11-13

20,024 downloads per month
Used in 48 crates (39 directly)

MIT license

28KB
467 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

~8MB
~139K SLoC