关于 ascii-art
ascii-art 是一项指导 Agent 使用本地命令行工具和免费网络服务制作、查找 ASCII 艺术的技能,涵盖文字横幅、消息图案、边框、图像转换及 QR 码等用途。
主要功能
- 01用 pyfiglet 或 asciified 制作文字横幅
- 02用 cowsay 生成对话框图案
- 03用 boxes 添加装饰边框
- 04用 ascii-image-converter 或 jp2a 转换图像
- 05查找现成图案并生成 QR 码或天气图形
适用场景
- 01制作项目名称或标题横幅
- 02将简短消息放入字符图案
- 03把图像转换为适合终端显示的文本
- 04获取主题图案或以 ASCII 显示 QR 码
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ nousresearch/ hermes-agent --skill ascii-art安装后在 Claude Code 中输入/ascii-art确认已加载。
详细介绍
ASCII 艺术技能
适用于不同 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 # Set width
python -m pyfiglet --list_fonts # List all 571 fonts
推荐字体
| 风格 | 字体 | 最适合用于 |
|---|---|---|
| 简洁现代 | slant | 项目名称、标题 |
| 粗体块状 | doom | 标题、徽标 |
| 大而清晰 | big | 横幅 |
| 经典横幅 | banner3 | 宽屏显示 |
| 紧凑 | small | 副标题 |
| 赛博朋克 | cyberlarge | 科技主题 |
| 3D 效果 | 3-d | 启动画面 |
| 哥特风格 | gothic | 戏剧化文字 |
提示
- 预览 2-3 种字体,让用户挑选最喜欢的
- 短文本(1-8 个字符)搭配
doom或block这类细节丰富的字体效果最好 - 长文本搭配
small或mini这类紧凑字体效果更好
工具 2:文字横幅(asciified API — 远程,无需安装)
可将文字转换为 ASCII 艺术的免费 REST API。提供 250 多种 FIGlet 字体。直接返回纯文本,无需解析。如果未安装 pyfiglet,或需要快速替代方案,可使用此工具。
用法(通过终端 curl)
# Basic text banner (default font)
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello+World"
# With a specific font
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"
# List all available fonts (returns JSON array)
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 the penguin
cowsay -f dragon "Rawr!" # Dragon
cowsay -f stegosaurus "Roar!" # Stegosaurus
cowthink "Hmm..." # Thought bubble
cowsay -l # List all characters
可用角色(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" # =_= eyes
cowsay -d "Dead" # x_x eyes
cowsay -g "Greedy" # $_$ eyes
cowsay -p "Paranoid" # @_@ eyes
cowsay -s "Stoned" # *_* eyes
cowsay -w "Wired" # O_O eyes
cowsay -e "OO" "Msg" # Custom eyes
cowsay -T "U " "Msg" # Custom tongue
工具 4:Boxes(装饰边框)
为任意文字绘制装饰性 ASCII 艺术边框/框架。内置 70 多种设计。
设置
sudo apt install boxes -y # Debian/Ubuntu
# brew install boxes # macOS
用法
echo "Hello World" | boxes # Default box
echo "Hello World" | boxes -d stone # Stone border
echo "Hello World" | boxes -d parchment # Parchment scroll
echo "Hello World" | boxes -d cat # Cat border
echo "Hello World" | boxes -d dog # Dog border
echo "Hello World" | boxes -d unicornsay # Unicorn
echo "Hello World" | boxes -d diamonds # Diamond pattern
echo "Hello World" | boxes -d c-cmt # C-style comment
echo "Hello World" | boxes -d html-cmt # HTML comment
echo "Hello World" | boxes -a c # Center text
boxes -l # List all 70+ designs
与 pyfiglet 或 asciified 组合使用
python -m pyfiglet "HERMES" -f slant | boxes -d stone
# Or without pyfiglet installed:
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" # Basic text art
toilet -f bigmono12 "Hello" # Specific font
toilet --gay "Rainbow!" # Rainbow coloring
toilet --metal "Metal!" # Metallic effect
toilet -F border "Bordered" # Add border
toilet -F border --gay "Fancy!" # Combined effects
toilet -f pagga "Block" # Block-style font (unique to toilet)
toilet -F list # List available filters
滤镜
crop、gay(彩虹)、metal、flip、flop、180、left、right、border
注意:toilet 会输出用于颜色的 ANSI 转义码,可在终端中使用,但在某些环境中可能无法正确显示(例如纯文本文件、部分聊天平台)。
工具 6:图像转 ASCII 艺术
将图像(PNG、JPEG、GIF、WEBP)转换为 ASCII 艺术。
选项 A:ascii-image-converter(推荐,现代)
# Install
sudo snap install ascii-image-converter
# OR: go install github.com/TheZoraiz/ascii-image-converter@latest
ascii-image-converter image.png # Basic
ascii-image-converter image.png -C # Color output
ascii-image-converter image.png -d 60,30 # Set dimensions
ascii-image-converter image.png -b # Braille characters
ascii-image-converter image.png -n # Negative/inverted
ascii-image-converter https://url/image.jpg # Direct URL
ascii-image-converter image.png --save-txt out # Save as text
选项 B:jp2a(轻量,仅支持 JPEG)
sudo apt install jp2a -y
jp2a --width=80 image.jpg
jp2a --colors image.jpg # Colorized
工具 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 ~/.hermes/cache/scratch/ascii_art.html
步骤 2 — 从 pre 标签中提取图案:
import os, re, html
with open(os.path.expanduser('~/.hermes/cache/scratch/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" # Full weather report with ASCII graphics
curl -s "wttr.in/Moon" # Moon phase in ASCII art
curl -s "v2.wttr.in/London" # Detailed version
工具 9:LLM 生成的自定义图案(备用方案)
当上述工具无法满足需求时,可直接使用以下 Unicode 字符生成 ASCII 艺术:
字符集
制表符画线字符: ╔ ╗ ╚ ╝ ║ ═ ╠ ╣ ╦ ╩ ╬ ┌ ┐ └ ┘ │ ─ ├ ┤ ┬ ┴ ┼ ╭ ╮ ╰ ╯
方块元素: ░ ▒ ▓ █ ▄ ▀ ▌ ▐ ▖ ▗ ▘ ▝ ▚ ▞
几何图形与符号: ◆ ◇ ◈ ● ○ ◉ ■ □ ▲ △ ▼ ▽ ★ ☆ ✦ ✧ ◀ ▶ ◁ ▷ ⬡ ⬢ ⌂
规则
- 最大宽度:每行 60 个字符(适合终端显示)
- 最大高度:横幅不超过 15 行,场景不超过 25 行
- 仅使用等宽字符:输出必须能在等宽字体中正确显示
决策流程
- 将文本做成横幅 → 如果已安装 pyfiglet,则使用 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 生成
- 未安装某个工具 → 安装该工具,或回退到下一个选项