项目
在 GitHub 查看
ratatui/ansi-to-tui
关于
Convert ansi colored text to tui::text::Text
开发工具实测星标增长
- 24小时
- 0
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文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) |
Minimum Supported Rust Version
Rust 1.88 or newer is required.
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.
探索相关项目
加载中…