diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-25 23:44:50 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-25 23:44:50 +1000 |
| commit | 35ea4a2dbca7969940e63b7655a613399a17259f (patch) | |
| tree | 07b424a9b52fa785482a10576d9afe83acbfd900 /src/caelestia/utils/wallpaper.py | |
| parent | schemes: fix static themes (diff) | |
| download | caelestia-cli-35ea4a2dbca7969940e63b7655a613399a17259f.tar.gz caelestia-cli-35ea4a2dbca7969940e63b7655a613399a17259f.tar.bz2 caelestia-cli-35ea4a2dbca7969940e63b7655a613399a17259f.zip | |
wallpaper: better variant detection
Diffstat (limited to 'src/caelestia/utils/wallpaper.py')
| -rw-r--r-- | src/caelestia/utils/wallpaper.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/caelestia/utils/wallpaper.py b/src/caelestia/utils/wallpaper.py index d3550ab..abaf192 100644 --- a/src/caelestia/utils/wallpaper.py +++ b/src/caelestia/utils/wallpaper.py @@ -80,14 +80,16 @@ def get_smart_opts(wall: Path, cache: Path) -> str: except (IOError, json.JSONDecodeError): pass + from caelestia.utils.colourfulness import get_variant + + opts = {} + with Image.open(get_thumb(wall, cache)) as img: + opts["variant"] = get_variant(img) + img.thumbnail((1, 1), Image.LANCZOS) hct = Hct.from_int(argb_from_rgb(*img.getpixel((0, 0)))) - - opts = { - "mode": "light" if hct.tone > 60 else "dark", - "variant": "neutral" if hct.chroma < 20 else "tonalspot", - } + opts["mode"] = "light" if hct.tone > 60 else "dark" opts_cache.parent.mkdir(parents=True, exist_ok=True) with opts_cache.open("w") as f: |