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

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

#36 in Command-line interface

Download history 5076/week @ 2024-11-29 7172/week @ 2024-12-06 5400/week @ 2024-12-13 6066/week @ 2024-12-20 4723/week @ 2024-12-27 5952/week @ 2025-01-03 5958/week @ 2025-01-10 5414/week @ 2025-01-17 4641/week @ 2025-01-24 4857/week @ 2025-01-31 5937/week @ 2025-02-07 4909/week @ 2025-02-14 6012/week @ 2025-02-21 6094/week @ 2025-02-28 4962/week @ 2025-03-07 3688/week @ 2025-03-14

21,442 downloads per month
Used in 56 crates (45 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

~6MB
~103K SLoC