From 9c468ffb40f832ff25f23bd6027b93ae8d40c7bf Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 5 Oct 2026 18:05:05 +0200 Subject: feat(accent): pick the colour that stands out, not the average colorz returned cluster means, which averaged a small vivid element into its surroundings, so a violet motif on a frame of pale skin came out as a muddy red. signature_color() now reads the pixels of a 256px thumbnail itself and scores each by chroma times its distance from the image's mean colour. The top 2% vote by hue, neighbouring bands summed, and the most vivid pixel near the peak is snapped. A pick under chroma 25 is a tint and takes the fallback. Dropping colorz also fixes two bugs. Its k-means seeds are random, so one wallpaper could snap differently between runs. And it calls sys.exit() on some images, which `except Exception` in main() does not catch, so udt-accent died without writing and the previous accent stayed. Over 314 wallpapers: no errors (colorz failed on 18), 25 fall back, about 0.06s each. The selftest gains a small-vivid-patch case and a grey-image case. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'AGENTS.md') diff --git a/AGENTS.md b/AGENTS.md index 55bdf2d..afb685a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -239,8 +239,17 @@ which would move every cache on the system, so `udt-accent` writes the real file to `~/.cache/udt/` and `install.sh` symlinks the old path at it. That directory now holds the link and nothing else. -**Extraction is deliberately isolated from pywal's cache.** It calls -`pywal.backends.colorz.get()` directly, which returns a list and writes nothing. +**The accent is what stands out, not what dominates.** `signature_color()` +reads the pixels itself (PIL, on a 256px thumbnail) and scores each by chroma +times its distance from the image's mean colour; the top 2% vote by hue. It +replaced pywal's colorz backend, whose cluster means averaged a small vivid +element into its surroundings, whose random seeds made one wallpaper snap +differently between runs, and which `sys.exit()`s on some images, which +`except Exception` did not catch, so the old accent stayed. A pick below +chroma 25 is a tint, and takes the fallback. + +**Extraction is deliberately isolated from pywal's cache.** It reads pixels +and writes nothing. Running `wal -i` instead would rewrite all of `~/.cache/wal`, including the terminal's ANSI colours, and that is the exact failure this design exists to avoid. If you change `signature_color()`, verify it still writes nothing. -- cgit v1.2.3