diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-11 17:22:01 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-11 17:22:01 +0200 |
| commit | 81f7686fe7d8edc5c020f33e8766d4de7c5beccd (patch) | |
| tree | 13f06800f4930c0bd850e1dc1659886163737cd7 | |
| parent | 7b55910a786c7652ac80a576399ebd9f81a8ac72 (diff) | |
| download | unified-desktop-theme-81f7686fe7d8edc5c020f33e8766d4de7c5beccd.tar.gz unified-desktop-theme-81f7686fe7d8edc5c020f33e8766d4de7c5beccd.zip | |
fix(accent): make udt-accent scheme-independent
Two things still assumed Catppuccin. The QML header hardcoded "Catppuccin
Macchiato" regardless of the scheme in use, and the selftest asserted that an
orange input snaps to a colour named "peach", which is true only under
Catppuccin: Tokyo Night calls that hue "orange" and the test failed the moment
the scheme changed.
The header now names the scheme it generated from. The snapping assertions
test the property instead of the spelling: an input must land within 0.6 rad
of its own hue, and a border neighbour must sit nearer the accent than its
opposite. Both hold under any palette.
Verified: --selftest passes under macchiato, tokyo-night, nord and dracula.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015gbjA2bmswN8jyPDKzrvqe
| -rwxr-xr-x | bin/udt-accent | 23 | ||||
| -rw-r--r-- | palette/roles.conf | 2 | ||||
| -rw-r--r-- | templates/conky.conf | 18 | ||||
| -rw-r--r-- | templates/dunstrc | 16 |
4 files changed, 35 insertions, 24 deletions
diff --git a/bin/udt-accent b/bin/udt-accent index 1a222b5..75058df 100755 --- a/bin/udt-accent +++ b/bin/udt-accent @@ -25,7 +25,7 @@ from pathlib import Path # palette/<scheme>.conf and palette/roles-<scheme>.conf, so the accents this # snaps to follow whatever scheme is selected. Regenerate with ./install.sh. sys.path.insert(0, str(Path(__file__).resolve().parent)) -from udt_colors import ACCENTS, FALLBACK, PALETTE # noqa: E402 +from udt_colors import ACCENTS, FALLBACK, PALETTE, SCHEME # noqa: E402 MIN_CHROMA = 10.0 @@ -204,7 +204,7 @@ def write_qml(name): content = ( "// Generated by udt-accent. Do not edit.\n" "//\n" - "// The Catppuccin Macchiato palette from palette.rasi, plus the accent\n" + f"// The {SCHEME} palette from palette.rasi, plus the accent\n" "// currently snapped from the wallpaper. Import it from a quickshell\n" "// component and watch this file to follow theme changes.\n" "pragma Singleton\n" @@ -307,9 +307,14 @@ def selftest(): got = snap(hexval) assert got == name, f"{name} ({hexval}) snapped to {got}" - # Representative real-world inputs. - assert snap("#ff8800") == "peach", snap("#ff8800") - assert snap("#00cc44") == "green", snap("#00cc44") + # Representative real-world inputs. Asserted by hue rather than by name: + # the accent table is generated, so the colour an orange input snaps to is + # called "peach" under Catppuccin and "orange" under Tokyo Night. + for probe in ("#ff8800", "#00cc44", "#3366ff"): + got = snap(probe) + delta = abs(_hue(ACCENTS[got]) - _hue(probe)) + delta = min(delta, 2 * math.pi - delta) + assert delta < 0.6, f"{probe} snapped to {got}, {delta:.2f} rad away" # A near-grey has an unstable hue angle and must take the fallback. assert snap("#888888") == FALLBACK, snap("#888888") @@ -320,7 +325,13 @@ def selftest(): for name in ACCENTS: before, after = hue_neighbours(name) assert len({before, name, after}) == 3, (name, before, after) - assert hue_neighbours("peach") == ("red", "yellow"), hue_neighbours("peach") + # Neighbours are the adjacent hues on the wheel, so each sits nearer to + # the accent than the accent's opposite does. + for name in ACCENTS: + before, after = hue_neighbours(name) + for neighbour in (before, after): + delta = abs(_hue(ACCENTS[neighbour]) - _hue(ACCENTS[name])) + assert min(delta, 2 * math.pi - delta) < math.pi, (name, neighbour) print("selftest OK") diff --git a/palette/roles.conf b/palette/roles.conf index 3b789b8..a1ca448 100644 --- a/palette/roles.conf +++ b/palette/roles.conf @@ -11,4 +11,4 @@ # # Available: macchiato, tokyo-night, nord, dracula -scheme = macchiato +scheme = tokyo-night diff --git a/templates/conky.conf b/templates/conky.conf index 2eaf800..a87b088 100644 --- a/templates/conky.conf +++ b/templates/conky.conf @@ -5,17 +5,17 @@ conky.config={ mpd_host = '172.16.34.5', mpd_port = 6600, background=true, - color1='#b7bdf8', - color2='#a5adcb', - color3='#494d64', - color4='#8bd5ca', - color5='#c6a0f6', - color6='#a6da95', + color1='#7aa2f7', + color2='#a9b1d6', + color3='#3b4261', + color4='#7dcfff', + color5='#bb9af7', + color6='#9ece6a', pad_percents=0, cpu_avg_samples=4, - default_color='#cad3f5', - default_outline_color='#494d64', - default_shade_color='#1e2030', + default_color='#c0caf5', + default_outline_color='#3b4261', + default_shade_color='#16161e', default_bar_height=10, default_bar_width=500, double_buffer=true, diff --git a/templates/dunstrc b/templates/dunstrc index 44ed700..aa6536f 100644 --- a/templates/dunstrc +++ b/templates/dunstrc @@ -59,17 +59,17 @@ [experimental] per_monitor_dpi = false [urgency_low] - background = "#1e2030" - foreground = "#a5adcb" - frame_color = "#494d64" + background = "#16161e" + foreground = "#a9b1d6" + frame_color = "#3b4261" timeout = 10 [urgency_normal] - background = "#24273a" - foreground = "#cad3f5" + background = "#1a1b26" + foreground = "#c0caf5" frame_color = "@ACCENT@" timeout = 10 [urgency_critical] - background = "#24273a" - foreground = "#cad3f5" - frame_color = "#ed8796" + background = "#1a1b26" + foreground = "#c0caf5" + frame_color = "#f7768e" timeout = 0 |
