diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-07 11:38:05 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-07 11:38:05 +1000 |
| commit | f9a83990a91e9b3ae694df53b64fe611520632a7 (patch) | |
| tree | b4992c9e7e7b0a04d9c7889f6b4b5f53d92ff4f9 /scheme | |
| parent | schemes: cache schemes (diff) | |
| download | caelestia-cli-f9a83990a91e9b3ae694df53b64fe611520632a7.tar.gz caelestia-cli-f9a83990a91e9b3ae694df53b64fe611520632a7.tar.bz2 caelestia-cli-f9a83990a91e9b3ae694df53b64fe611520632a7.zip | |
scheme: better colours + parallel generation
Fix some wallpapers not having enough colours by disabling filter (also gives better colours)
Use GNU parallel to run scheme generation in parallel
Also ensure all schemes exist when generating
Cache wallpaper thumbnails
Diffstat (limited to 'scheme')
| -rwxr-xr-x | scheme/gen-scheme.fish | 16 | ||||
| -rwxr-xr-x | scheme/score.py | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/scheme/gen-scheme.fish b/scheme/gen-scheme.fish index ab19c81..c034980 100755 --- a/scheme/gen-scheme.fish +++ b/scheme/gen-scheme.fish @@ -12,13 +12,19 @@ set -l hash (sha1sum $img | cut -d ' ' -f 1) # Cache schemes mkdir -p $C_CACHE/schemes -if ! test -d $C_CACHE/schemes/$hash - # Generate colours - set -l colours ($src/score.py $img) +set -l dirty_variants +if test -d $C_CACHE/schemes/$hash for variant in $variants - mkdir -p $C_CACHE/schemes/$hash/$variant - $src/autoadjust.py $theme $variant $colours | head -c -1 > $C_CACHE/schemes/$hash/$variant/$theme.txt + test -f $C_CACHE/schemes/$hash/$variant/$theme.txt || set -a dirty_variants $variant end +else + set dirty_variants $variants +end + +if test -n "$dirty_variants" + # Generate schemes for variants that need it + set -l colours ($src/score.py $img) + parallel "mkdir -p $C_CACHE/schemes/$hash/{} && $src/autoadjust.py $theme {} '$colours' | head -c -1 > $C_CACHE/schemes/$hash/{}/$theme.txt" ::: $dirty_variants end # Copy schemes from cache diff --git a/scheme/score.py b/scheme/score.py index 00a6d53..49464a2 100755 --- a/scheme/score.py +++ b/scheme/score.py @@ -22,7 +22,7 @@ class Score: @staticmethod def score(colors_to_population: dict) -> list[int]: desired = 14 - filter_enabled = True + filter_enabled = False dislike_filter = True colors_hct = [] |