dotfiles 主题包添加
add-theme
在 dotfiles 主题系统(bin/theme)中添加主题包,或让壁纸与现有主题相匹配。当用户粘贴主题仓库 URL 或图片、说“add this theme”“new theme pack”,或希望在 theme next to cycle 中增加一个条目时使用。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 3.0k
- Forks
- 371
01 前言 Front Matter
- name
- add-theme
- description
- Add a theme pack or match a wallpaper to an existing theme in the dotfiles theme system (bin/theme). Use when the user pastes a theme repo URL or image, says "add this theme", "new theme pack", or wants another entry for theme next to cycle.
03 SKILL.md 正文
Add a theme pack
One command themes everything: bin/theme <name> renders the pack into
~/.local/state/theme/current/theme/ and nudges every consumer. A pack is
themes/<name>/ and needs only:
colors.toml— the contract. Either style: semantic (mode,accent,background,foreground,muted,red,bright_red,dark_background, ...) or ANSI (accent,background,foreground,color0-color15).bin/theme-color -f colors.toml --allshows the full set after aliasing and derivation; anything missing is mixed from what is there.backgrounds/— images.theme <name> [N]picks the Nth (sorted by name),theme bg nextcycles. Name them<index>-<description>.<ext>; the fzf picker previews the filename.theme.conf—TAGLINE="one line of whimsy"(printed on switch, shown in the tmux cheat sheet). Optional but every pack has one.icons.theme— optional, a GTK icon theme name (Yaru-* is common); applied on Linux only if that icon set is installed.
Every app file (ghostty, kitty, wezterm, tmux, nvim, btop, starship, pi,
claude, hyprland borders, hyprlock, wofi, slack) is
rendered from themes/templates/*.tpl. A pack may ship a file under the
same name to hand-tune one app (hyprland.lua for a gradient border,
btop.theme, ...); it wins over the template. Do NOT hand-author the rest.
Work directly in the repo (subagent worktrees don't see uncommitted theme files and have flipped the user's live theme by running theme from the wrong tree — do NOT run theme for validation until told, and never from a worktree).
Sources
- An existing theme repo (any
themes/<name>/laid out as above): copycolors.toml,backgrounds/,icons.theme. Skipneovim.lua,vscode.json,preview*.png,unlock.png,shell*.toml,keyboard.rgb,chromium.theme. Keep a shippedbtop.theme; keep a shippedhyprland.luaonly if it is plainhl.config(theo.window(...)helper style some repos use does not exist here). An older theme with onlyalacritty.tomland nocolors.toml: transcribe its[colors.*]into ANSI-stylecolors.toml. - Just a wallpaper: first run
bin/theme adopt <image>. It compares the extracted palette with every existing pack and, when the closest score is 60 or lower, copies the image into that pack'sbackgrounds/with the next numeric prefix. A weaker match changes nothing and prints the three closest packs. Then usebin/theme from-image <name> <image>to create a new pack; it writescolors.toml+backgrounds/+ an emptytheme.conf. Both commands use heuristic hue mapping, so eyeball the result.
Then write theme.conf with a TAGLINE in the house style (see
themes/*/theme.conf: short, lower-case, a little wry).
Validate (no theme run)
bin/theme-color -f themes/<name>/colors.toml --all # no error, sane mode
bin/theme-color -f themes/<name>/colors.toml --name <name> --render /tmp/x themes/templates/*.tpl
jq empty /tmp/x/*.json; bash -n /tmp/x/*.sh
ghostty +validate-config --config-file=/tmp/x/ghostty.conf
A rendered file containing {{ means a template names a key the resolver
does not produce; fix the template, not the pack.
Hand verification to the user or ask before switching
theme <name> [N], then: tmux show-option -gqv @thm_pink == accent;
cat ~/.local/state/theme/current/mode; jq -r .theme ~/.claude/settings.json
== custom:<name>. Linux: hyprctl getoption general:col.active_border,
gsettings get org.gnome.desktop.interface color-scheme. macOS:
wallpaper after a few seconds. Pi applies on next launch.
Commit on the active theme branch and push.
Removing a theme
git rm -r themes/<name>/, then theme <other>. The rendered
~/.pi/agent/themes/<name>.json and ~/.claude/themes/<name>.json can go
too.