diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-05 18:05:05 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-05 18:05:05 +0200 |
| commit | 9c468ffb40f832ff25f23bd6027b93ae8d40c7bf (patch) | |
| tree | 80914e650315df794d6b50fd8fb45dede71e1112 /AGENTS.md | |
| parent | f89e3b7dc5dbad2fce9a62e644c11cb963547349 (diff) | |
| download | unified-desktop-theme-9c468ffb40f832ff25f23bd6027b93ae8d40c7bf.tar.gz unified-desktop-theme-9c468ffb40f832ff25f23bd6027b93ae8d40c7bf.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'AGENTS.md')
| -rw-r--r-- | AGENTS.md | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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. |
