/
View dependency graph
Depends on
- dh-cargo (dh-sequence-cargo)
- cargo, debhelper-compat, librust-nom-8+default-dev, librust-ratatui-core-0.1-dev, librust-simdutf8-0.1+default-dev, librust-smallvec-1+const-generics-dev, librust-smallvec-1+default-dev, librust-thiserror-2+default-dev, libstd-rust-dev, rustc
Used by
README (full)
ansi-to-tui
Convert ANSI color and style codes into Ratatui Text.
This crate parses bytes containing ANSI SGR escape sequences (like \x1b[31m).
It produces a Ratatui Text with equivalent foreground/background Color and
Modifier settings via Style.
Unknown or malformed escape sequences are ignored so you can feed it real terminal output without having to pre-clean it.
| Color Mode | Supported | SGR Example | Ratatui Color Example |
|---|---|---|---|
| Named (3/4-bit, 8/16-color) | ✓ | \x1b[30..37;40..47m | Color::Blue |
| Indexed (8-bit, 256-color) | ✓ | \x1b[38;5;<N>m | Color::Indexed(1) |
| Truecolor (24-bit RGB) | ✓ | \x1b[38;2;<R>;<G>;<B>m | Color::Rgb(255, 0, 0) |
Example
use ansi_to_tui::IntoText as _;
let buffer = std::fs::read("ascii/text.ascii")?;
let output = buffer.into_text()?;
Contributing and CI details are in CONTRIBUTING.md.
| dir | .cargo/ |
| dir | .github/ |
| dir | ascii/ |
| dir | benches/ |
| dir | debian/ |
| dir | src/ |
| file | .cargo_vcs_info.json |
| file | .envrc |
| file | .gitignore |
| file | .markdownlint-cli2.yaml |
| file | CHANGELOG.md |
| file | CONTRIBUTING.md |
| file | Cargo.lock |
| file | Cargo.toml |
| file | Cargo.toml.orig |
| file | LICENSE |
| file | README.md |
| file | deny.toml |
| file | flake.lock |
| file | flake.nix |