ansi-to-tui
Parse text with ANSI color codes and turn them into tui::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::ansi_to_text;
use std::io::Read;
let mut input = std::fs::File::open("ascii/text.ascii").unwrap();
let mut buffer: Vec<u8> = Vec::new();
file.read_to_end(&mut buffer);
let output = ansi_to_text(buffer);