项目
在 GitHub 查看
nidhoggfgg/rsille
关于
The rsille is a Rust library for drawing graphics in the terminal
设计与媒体可以做什么
- raster - Yes - An RGB canvas for displaying pixels in terminals that support the Kitty graphics protocol or Sixel.
- overlay - No - Interactive widgets over a running shell and events for tracking shell commands. Also enables raster.
实测星标增长
- 24小时
- 0
- 7天
- +6
- 15天
- +6
- 1个月
- +6
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README_cn.md
原文rsille
English · 中文
rsille 是用 Rust 构建终端界面和绘制图形的框架。你可以把按钮、文本编辑器和画布放进同一个布局,让应用直接显示在命令行中,也可以让它占满整个终端。
示例
| TUI · 用组件搭建可拖动的窗口 | Canvas · 用 Unicode 字符绘制彩色图形 |
|---|---|
![]() |
![]() ![]() |
数学渲染 · 用 Typst 排版公式,用 rsille draw 绘图 |
overlay · 叠加在其他 TUI 和 shell 之上 |
|---|---|
![]() ![]() |
![]() |
快速开始
做一个可搜索的主题切换器
输入 li 筛出 Light,按 Enter,整个面板就会切换到浅色。也可以用 ↑ / ↓ 选择主题,按 Esc 退出。

在 Rust 项目的 Cargo.toml 中添加依赖。
[dependencies]
rsille = "3"
把下面的代码放进 src/main.rs,运行 cargo run。
use rsille::tui::prelude::*;
fn main() -> WidgetResult<()> {
App::new(String::from("Tokyo Night"))
.mode(Mode::Inline)
.with_theme_from(|name| match name.as_str() {
"Light" => Theme::light(),
"Dracula" => Theme::dracula(),
_ => Theme::tokyo_night(),
})
.update(|name, choice, ctx| match choice {
Some(next) => *name = next,
None => ctx.exit(),
})
.view(|name| {
command_palette()
.border(BorderStyle::Rounded)
.title(format!("Theme · {name}"))
.placeholder("Search themes")
.items(["Tokyo Night", "Dracula", "Light"].map(|s| CommandItem::new(s, s)))
.on_submit(Some)
.on_close(|| None)
})
.run()?;
Ok(())
}
体验 Playground
安装独立的 rsille-playground 包,运行 rsille 打开交互式演示菜单。
cargo install rsille-playground --locked
rsille
也可以用 rsille draw 打开函数绘图器,或用 rsille pet 启动终端宠物。完整命令与终端兼容性见 Playground 指南。
Cargo 特性
| 特性 | 默认启用 | 用途 |
|---|---|---|
raster |
是 | 使用 RGB 画布,在支持 Kitty 图形协议或 Sixel 的终端中显示像素图像。 |
overlay |
否 | 在运行中的 shell 上方显示交互组件,响应命令执行等事件。启用时也会启用 raster。 |
要构建 shell 浮层,在 Cargo.toml 中启用 overlay。
[dependencies]
rsille = { version = "3", features = ["overlay"] }
如果只用基础组件和 Unicode 画布,可以在 rsille 依赖上设置 default-features = false。
其他资源
- Rust API 文档 · 组件与布局 · Unicode 画布 · 终端缓冲区与渲染
- 扩展包:Typst 公式渲染 · 语法高亮
- rsille 编程助手 skill · MIT 许可
探索相关项目
加载中…





