From 7b55910a786c7652ac80a576399ebd9f81a8ac72 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 11 Sep 2026 17:20:50 +0200 Subject: feat(palette): generate every themed config from one scheme Colours were written down five times: rofi's palette.rasi, the waybar theme, the kitty theme, the conky and dunst templates, and a MACCHIATO dict inside udt-accent. Changing scheme meant finding all five, and they had already drifted: the active waybar theme was Macchiato while theme.css next to it was Mocha, and nothing imported the latter. Now a scheme is two files. palette/.conf holds the colours under the scheme's own names, and palette/roles-.conf says what each is for. palette/roles.conf is one `scheme =` line selecting the pair. bin/udt-palette renders that into each consumer's syntax and install.sh runs it first. The role map is per-scheme rather than shared because the palettes are genuinely different shapes: Nord has no `base`, Dracula no `surface0`, and forcing Catppuccin's names onto them would have meant either renaming their colours or inventing values. A role names a palette colour with two optional modifiers, `name/75` for alpha and `name*50` for brightness. The second exists because GTK's shade() has no palette name to point at. Ships macchiato, tokyo-night, nord and dracula. --selftest resolves every role in every scheme and asserts they define the same set, so a scheme that cannot satisfy a consumer fails at install rather than when someone switches to it. Verified against the live configs: all 46 waybar colours resolve identically to the previously active theme including its alpha() and shade() derivations, the kitty theme is colour-for-colour identical, and the rofi palette has the same 26 values. Generated files are gitignored; switching scheme and switching back reproduces the originals. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_015gbjA2bmswN8jyPDKzrvqe --- install.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'install.sh') diff --git a/install.sh b/install.sh index 1b51947..5489f46 100755 --- a/install.sh +++ b/install.sh @@ -9,6 +9,12 @@ target="$HOME/.config/rofi/udt" mkdir -p "$target" "$HOME/bin" "$HOME/.cache/wal" +# Generate every themed config from the selected scheme first: the rofi palette +# symlinked below is one of its outputs, so this has to run before anything is +# linked. It fails loudly if a role names a colour the scheme does not define, +# which is the whole point of keeping the colours in one place. +"$repo/bin/udt-palette" + # Theme files are symlinked individually; accent.rasi is NOT, it points at the # generated file in the wal cache instead. for f in palette.rasi common.rasi menu.rasi list.rasi grid.rasi powermenu.rasi confirm.rasi; do @@ -30,6 +36,25 @@ fi ln -sfn "$HOME/.cache/wal/udt-accent.rasi" "$target/accent.rasi" ln -sfn "$repo/bin/udt-accent" "$HOME/bin/udt-accent" +ln -sfn "$repo/bin/udt-palette" "$HOME/bin/udt-palette" + +# The generated configs for everything that is not rofi. These are copied +# rather than symlinked: each app owns its config file and mixes theme keys +# with settings that are none of this repo's business. +scheme="$(sed -n 's/^scheme *= *//p' "$repo/palette/roles.conf")" + +# waybar reads whichever themes/.css style.css imports, so write the file +# under the scheme's own name and repoint the import. The older per-flavour +# files in themes/ are left alone; they are simply no longer imported. +install -Dm644 "$repo/templates/waybar/theme.css" \ + "$HOME/.config/waybar/themes/$scheme.css" +if [ -f "$HOME/.config/waybar/style.css" ]; then + sed -i "s|@import \"themes/.*\.css\";|@import \"themes/$scheme.css\";|" \ + "$HOME/.config/waybar/style.css" +fi + +install -Dm644 "$repo/templates/terminal/kitty-theme.conf" \ + "$HOME/.config/kitty/current-theme.conf" echo "installed:" ls -l "$target" "$HOME/bin/udt-accent" -- cgit v1.2.3