Ascii Art
ASCII 艺术:pyfiglet、cowsay、boxes、图片转 ASCII。
Skill metadata
| Source | 可选 — 使用 hermes skills install official/creative/ascii-art 安装 |
| Path | optional-skills/creative\ascii-art |
| Version | 4.0.0 |
| Author | 0xbyt4, Hermes Agent |
| License | MIT |
| Platforms | linux, macos, windows |
| Tags | ASCII, Art, Banners, Creative, Unicode, Text-Art, pyfiglet, figlet, cowsay, boxes |
| Related skills | excalidraw |
参考:完整的 SKILL.md
以下是 Hermes 在此技能被触发时加载的完整技能定义。这就是智能体在技能激活时看到的指令内容。
ASCII Art 技能
针对不同 ASCII 艺术需求的多种工具。所有工具都是本地 CLI 程序或免费 REST API —— 无需 API 密钥。
工具 1:文本横幅(pyfiglet — 本地)
将文本渲染为大型 ASCII 艺术横幅。内置 571 种字体。
安装
pip install pyfiglet --break-system-packages -q
用法
python -m pyfiglet "YOUR TEXT" -f slant
python -m pyfiglet "TEXT" -f doom -w 80 # 设置宽度
python -m pyfiglet --list_fonts # 列出全部 571 种字体
推荐字体
| 风格 | 字体 | 最适合 |
|---|---|---|
| 简洁现代 | slant | 项目名称、标题 |
| 粗犷块状 | doom | 标题、标志 |
| 大而清晰 | big | 横幅 |
| 经典横幅 | banner3 | 宽屏展示 |
| 紧凑 | small | 副标题 |
| 赛博朋克 | cyberlarge | 科技主题 |
| 3D 效果 | 3-d | 启动画面 |
| 哥特 | gothic | 戏剧化文本 |
提示
- 预览 2-3 种字体,让用户挑选喜欢的
- 短文本(1-8 个字符)最适合使用
doom或block等精细字体 - 长文本更适合使用
small或mini等紧凑字体
工具 2:文本横幅(asciified API — 远程,无需安装)
免费的 REST API,可将文本转换为 ASCII 艺术。含 250+ FIGlet 字体。直接返回纯文本 —— 无需解析。当 pyfiglet 未安装时,可将其作为快速替代方案。
用法(通过终端 curl)
# 基础文本横幅(默认字体)
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello+World"
# 指定字体
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Slant"
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Doom"
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Star+Wars"
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=3-D"
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Banner3"
# 列出所有可用字体(返回 JSON 数组)
curl -s "https://asciified.thelicato.io/api/v2/fonts"
提示
- 在 text 参数中将空格 URL 编码为
+ - 响应是纯文本 ASCII 艺术 —— 没有 JSON 包装,可直接显示
- 字体名称区分大小写;使用 fonts 端点获取准确名称
- 任何有 curl 的终端均可使用 —— 不需要 Python 或 pip
工具 3:Cowsay(消息艺术)
经典工具,用 ASCII 角色将文本包裹在对话气泡中。
安装
sudo apt install cowsay -y # Debian/Ubuntu
# brew install cowsay # macOS
用法
cowsay "Hello World"
cowsay -f tux "Linux rules" # 企鹅 Tux
cowsay -f dragon "Rawr!" # 龙
cowsay -f stegosaurus "Roar!" # 剑龙
cowthink "Hmm..." # 思考气泡
cowsay -l # 列出所有角色
可用角色(50+)
beavis.zen, bong, bunny, cheese, daemon, default, dragon,
dragon-and-cow, elephant, eyes, flaming-skull, ghostbusters,
hellokitty, kiss, kitty, koala, luke-koala, mech-and-cow,
meow, moofasa, moose, ren, sheep, skeleton, small,
stegosaurus, stimpy, supermilker, surgery, three-eyes,
turkey, turtle, tux, udder, vader, vader-koala, www
眼睛/舌头修饰符
cowsay -b "Borg" # =_= 眼睛
cowsay -d "Dead" # x_x 眼睛
cowsay -g "Greedy" # $_$ 眼睛
cowsay -p "Paranoid" # @_@ 眼睛
cowsay -s "Stoned" # *_* 眼睛
cowsay -w "Wired" # O_O 眼睛
cowsay -e "OO" "Msg" # 自定义眼睛
cowsay -T "U " "Msg" # 自定义舌头
工具 4:Boxes(装饰性边框)
围绕任意文本绘制装饰性 ASCII 艺术边框/框架。内置 70+ 种设计。
安装
sudo apt install boxes -y # Debian/Ubuntu
# brew install boxes # macOS
用法
echo "Hello World" | boxes # 默认方框
echo "Hello World" | boxes -d stone # 石头边框
echo "Hello World" | boxes -d parchment # 羊皮纸卷轴
echo "Hello World" | boxes -d cat # 猫咪边框
echo "Hello World" | boxes -d dog # 狗狗边框
echo "Hello World" | boxes -d unicornsay # 独角兽
echo "Hello World" | boxes -d diamonds # 菱形图案
echo "Hello World" | boxes -d c-cmt # C 风格注释
echo "Hello World" | boxes -d html-cmt # HTML 注释
echo "Hello World" | boxes -a c # 居中文本
boxes -l # 列出全部 70+ 种设计
与 pyfiglet 或 asciified 组合
python -m pyfiglet "HERMES" -f slant | boxes -d stone
# 或者未安装 pyfiglet 时:
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=HERMES&font=Slant" | boxes -d stone
工具 5:TOIlet(彩色文本艺术)
类似 pyfiglet,但带有 ANSI 颜色效果和视觉滤镜。非常适合终端视觉享受。
安装
sudo apt install toilet toilet-fonts -y # Debian/Ubuntu
# brew install toilet # macOS
用法
toilet "Hello World" # 基础文本艺术
toilet -f bigmono12 "Hello" # 指定字体
toilet --gay "Rainbow!" # 彩虹着色
toilet --metal "Metal!" # 金属效果
toilet -F border "Bordered" # 添加边框
toilet -F border --gay "Fancy!" # 组合效果
toilet -f pagga "Block" # 块状字体(toilet 独有)
toilet -F list # 列出可用滤镜
滤镜
crop、gay(彩虹)、metal、flip、flop、180、left、right、border
注意:toilet 会输出用于着色的 ANSI 转义码 —— 在终端中可用,但可能无法在所有环境中正常渲染(例如纯文本文件、某些聊天平台)。
工具 6:图片转 ASCII 艺术
将图片(PNG、JPEG、GIF、WEBP)转换为 ASCII 艺术。
选项 A:ascii-image-converter(推荐,现代)
# 安装
sudo snap install ascii-image-converter
# 或:go install github.com/TheZoraiz/ascii-image-converter@latest
ascii-image-converter image.png # 基础
ascii-image-converter image.png -C # 彩色输出
ascii-image-converter image.png -d 60,30 # 设置尺寸
ascii-image-converter image.png -b # 盲文字符
ascii-image-converter image.png -n # 负片/反色
ascii-image-converter https://url/image.jpg # 直接使用 URL
ascii-image-converter image.png --save-txt out # 保存为文本
选项 B:jp2a(轻量,仅限 JPEG)
sudo apt install jp2a -y
jp2a --width=80 image.jpg
jp2a --colors image.jpg # 着色
工具 7:搜索现成的 ASCII 艺术
从网络上搜索精选的 ASCII 艺术。使用 terminal 配合 curl。
来源 A:ascii.co.uk(推荐用于现成艺术)
大型经典 ASCII 艺术集合,按主题分类。艺术藏在 HTML 的 <pre> 标签内。用 curl 获取页面,然后用一小段 Python 代码提取艺术。
URL 模式: https://ascii.co.uk/art/{subject}
第 1 步 —— 获取页面:
curl -s 'https://ascii.co.uk/art/cat' -o /tmp/ascii_art.html
第 2 步 —— 从 pre 标签中提取艺术:
import re, html
with open('/tmp/ascii_art.html') as f:
text = f.read()
arts = re.findall(r'<pre[^>]*>(.*?)</pre>', text, re.DOTALL)
for art in arts:
clean = re.sub(r'<[^>]+>', '', art)
clean = html.unescape(clean).strip()
if len(clean) > 30:
print(clean)
print('\n---\n')
可用主题(用作 URL 路径):
- 动物:
cat、dog、horse、bird、fish、dragon、snake、rabbit、elephant、dolphin、butterfly、owl、wolf、bear、penguin、turtle - 物品:
car、ship、airplane、rocket、guitar、computer、coffee、beer、cake、house、castle、sword、crown、key - 自然:
tree、flower、sun、moon、star、mountain、ocean、rainbow - 角色:
skull、robot、angel、wizard、pirate、ninja、alien - 节日:
christmas、halloween、valentine
提示:
- 保留作者的签名/名字缩写 —— 这是重要的礼节
- 每页有多个艺术片段 —— 为用户挑选最好的一个
- 通过 curl 可靠运行,无需 JavaScript
来源 B:GitHub Octocat API(有趣的彩蛋)
返回一个随机的 GitHub Octocat 配上一句点睛之语。无需认证。
curl -s https://api.github.com/octocat
工具 8:有趣的 ASCII 实用工具(通过 curl)
这些免费服务直接返回 ASCII 艺术 —— 非常适合做趣味附加内容。
二维码转 ASCII 艺术
curl -s "qrenco.de/Hello+World"
curl -s "qrenco.de/https://example.com"
天气转 ASCII 艺术
curl -s "wttr.in/London" # 带 ASCII 图形的完整天气报告
curl -s "wttr.in/Moon" # ASCII 艺术形式的月相
curl -s "v2.wttr.in/London" # 详细版本
工具 9:LLM 生成自定义艺术(备用方案)
当上述工具没有所需内容时,使用以下 Unicode 字符直接生成 ASCII 艺术:
字符调色板
制表符: ╔ ╗ ╚ ╝ ║ ═ ╠ ╣ ╦ ╩ ╬ ┌ ┐ └ ┘ │ ─ ├ ┤ ┬ ┴ ┼ ╭ ╮ ╰ ╯
块元素: ░ ▒ ▓ █ ▄ ▀ ▌ ▐ ▖ ▗ ▘ ▝ ▚ ▞
几何与符号: ◆ ◇ ◈ ● ○ ◉ ■ □ ▲ △ ▼ ▽ ★ ☆ ✦ ✧ ◀ ▶ ◁ ▷ ⬡ ⬢ ⌂
规则
- 每行最大宽度:60 个字符(对终端安全)
- 最大高度:横幅 15 行,场景 25 行
- 仅限等宽:输出必须在定宽字体下正确渲染
决策流程
- 文本做横幅 → 若已安装 pyfiglet 则用其,否则通过 curl 使用 asciified API
- 用有趣的角色艺术包裹消息 → cowsay
- 添加装饰性边框/框架 → boxes(可与 pyfiglet/asciified 组合)
- 特定事物(猫、火箭、龙)的艺术 → 通过 curl + 解析访问 ascii.co.uk
- 将图片转换为 ASCII → ascii-image-converter 或 jp2a
- 二维码 → 通过 curl 使用 qrenco.de
- 天气/月亮艺术 → 通过 curl 使用 wttr.in
- 自定义/创意内容 → 使用 Unicode 调色板的 LLM 生成
- 任何未安装的工具 → 安装它,或回退到下一个选项