← 返回 Skills 市场
Rich
作者
CN-big-cabbage
· GitHub ↗
· v0.1.0
· MIT-0
76
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install rich
功能描述
Rich - Python 终端富文本和美化格式库
使用说明 (SKILL.md)
Rich - Python 终端富文本和美化格式库
技能概述
本技能帮助用户使用 Rich 在 Python 终端程序中输出美观的富文本内容,支持以下场景:
- 彩色输出: 使用标记语法为文本添加颜色、样式和表情符号
- 表格渲染: 创建美观的 ASCII 表格,支持多种边框样式
- 进度条: 显示任务进度、下载进度、批量操作进度
- Markdown 渲染: 在终端中渲染 Markdown 文本
- 语法高亮: 对代码片段进行语法高亮显示
- 结构化日志: 替换标准 logging,输出格式化日志
- Python 对象美化打印: 替代 pprint,输出带颜色和折叠的对象
GitHub: https://github.com/Textualize/rich(56k+ Stars)
使用流程
AI 助手将引导你完成以下步骤:
- 安装 Rich(如未安装)
- 选择合适的组件(Console、Table、Progress 等)
- 编写代码并查看效果
- 根据需求调整样式和配置
关键章节导航
AI 助手能力
当你向 AI 描述终端输出需求时,AI 会:
- 自动生成对应的 Rich 代码片段
- 选择最合适的 Rich 组件(Table/Panel/Progress 等)
- 调整颜色、样式等视觉参数
- 集成到现有项目代码中
- 处理不同终端环境的兼容性问题
- 将 print/logging 替换为 Rich 输出
核心功能
- 支持 Console 对象统一管理终端输出
- 支持标记语法(Markup)设置文本样式
- 支持 16/256/True Color 颜色模式
- 支持 Table(表格)、Panel(面板)、Tree(树形)等渲染组件
- 支持 Progress(进度条)和 Live(动态刷新)
- 支持 Syntax(语法高亮)和 Markdown(文档渲染)
- 支持 Traceback(美化异常追踪)
- 支持 Inspect(对象检查)
- 支持 Logging Handler 集成
- 支持导出 HTML/SVG 终端截图
快速示例
# 最简单的用法 - 使用全局 print
from rich import print
print("[bold magenta]Hello[/bold magenta], [green]World[/green]! :sparkles:")
# 使用 Console 对象
from rich.console import Console
console = Console()
console.print("[bold]Rich[/bold] is [italic green]awesome[/italic green]!")
# 美化打印 Python 对象
from rich import pretty
pretty.install()
{"name": "rich", "stars": 56000, "features": ["color", "table", "progress"]}
# 渲染表格
from rich.console import Console
from rich.table import Table
console = Console()
table = Table(title="Python 包对比")
table.add_column("名称", style="cyan", no_wrap=True)
table.add_column("Stars", style="magenta")
table.add_column("用途", style="green")
table.add_row("rich", "56k+", "终端美化")
table.add_row("click", "14k+", "命令行解析")
table.add_row("typer", "13k+", "CLI 框架")
console.print(table)
# 进度条
from rich.progress import track
for step in track(range(100), description="处理中..."):
# 执行任务
pass
安装要求
- Python 3.8 或更高版本
- pip 包管理器
- 支持 ANSI 转义码的终端(macOS Terminal、iTerm2、Windows Terminal、Linux 各终端)
许可证
MIT License
项目链接
安全使用建议
This guide appears coherent and focused on teaching/using the Rich library. Before running anything the AI suggests: 1) Prefer installing into a virtual environment (venv/conda) rather than globally. 2) Review any pip/conda commands the agent will execute, and avoid running arbitrary code from unknown sources. 3) Be cautious enabling traceback.show_locals or installing pretty() globally — these can reveal local variables (including secrets) on exceptions or REPL sessions. 4) When logging to files or exporting HTML/SVG, remember outputs are persisted locally and may contain sensitive data. 5) If you want the AI to modify your project files, review diffs before applying changes. No credentials are requested by this skill.
能力评估
Purpose & Capability
Name/description, included guides, and the single declared dependency ('rich') match: all instructions and examples are about installing and using the Rich library and its components (Console, Table, Progress, Syntax, etc.). No unrelated credentials, binaries, or config paths are requested.
Instruction Scope
The SKILL.md and guides instruct the agent to run typical local commands (python --version, pip install rich, python -m rich), create or edit local files, and modify application code to integrate Rich (replace print/pprint, install traceback/pretty). These are within scope, but some recommended actions can expose sensitive data if used carelessly — e.g., traceback.install(show_locals=True) and logging handlers that record locals can reveal secrets; writing logs/exported HTML/SVG to disk may persist output. The skill does not instruct any network exfiltration or access to unrelated system configuration.
Install Mechanism
This is an instruction-only skill (no install spec). Install guidance uses normal package managers (pip, conda, pip install git+https://github.com/Textualize/rich.git, uv add). No downloads from suspicious hosts or archive extraction instructions are present.
Credentials
The skill requests no environment variables or credentials. It suggests setting benign environment variables related to terminal color (FORCE_COLOR, TERM, NO_COLOR) and recommends virtual environments. Be aware that examples show writing logs/files (app.log, output.html/output.svg) and enabling show_locals for tracebacks — these could persist or display sensitive values if the program processes secrets.
Persistence & Privilege
always is false and the skill does not request permanent platform privileges or modify other skills. It is instruction-only and does not ask to store tokens or change agent-wide settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install rich - 安装完成后,直接呼叫该 Skill 的名称或使用
/rich触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Initial release - Python rich text and beautiful formatting library skill distilled from github.com/Textualize/rich (50k+ stars)
元数据
常见问题
Rich 是什么?
Rich - Python 终端富文本和美化格式库. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 76 次。
如何安装 Rich?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install rich」即可一键安装,无需额外配置。
Rich 是免费的吗?
是的,Rich 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Rich 支持哪些平台?
Rich 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Rich?
由 CN-big-cabbage(@cn-big-cabbage)开发并维护,当前版本 v0.1.0。
推荐 Skills