[go: up one dir, main page]

ansi-to-tui 0.1.6

A library to convert ansi color coded text into tui::text::Text type from tui-rs library
Documentation

ansi-to-tui

Build & Tests

Parse text with ansi color codes and turn them into tui::text::Text.

Supports TrueColor ( RGB ) ( \x1b[38;2;<r>;<g>;<b>m)
Supports 8 - Bit Color ( 0..256 ) ( \x1b[38;5;<n>m )
Supports 4 - Bit Color Pallete ( \x1b[30..37;40..47m )

Example

use ansi_to_tui::ansi_to_text;
use std::io::Read;

let file = std::fs::File::open("text.ascii");
let mut buffer: Vec<u8> = Vec::new();
let text = ansi_to_text(buffer);

A naive implementation, relatively fast. Only dependency is the tui crate. Lots of room for improvement.