diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-12 21:57:09 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-12 21:57:09 +1000 |
| commit | 558a086bcd5a17ea92139bcafeceaf5da5d5be30 (patch) | |
| tree | e5e6e544465df3975c7137fee2b333f2222bac5d /src/caelestia/utils | |
| parent | wallpaper: cache smart mode (diff) | |
| download | caelestia-cli-558a086bcd5a17ea92139bcafeceaf5da5d5be30.tar.gz caelestia-cli-558a086bcd5a17ea92139bcafeceaf5da5d5be30.tar.bz2 caelestia-cli-558a086bcd5a17ea92139bcafeceaf5da5d5be30.zip | |
scheme: ensure enough colours
Diffstat (limited to 'src/caelestia/utils')
| -rwxr-xr-x | src/caelestia/utils/material/score.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/caelestia/utils/material/score.py b/src/caelestia/utils/material/score.py index da8b062..7765050 100755 --- a/src/caelestia/utils/material/score.py +++ b/src/caelestia/utils/material/score.py @@ -20,9 +20,8 @@ class Score: pass @staticmethod - def score(colors_to_population: dict) -> tuple[list[Hct], list[Hct]]: + def score(colors_to_population: dict, filter_enabled: bool = True) -> tuple[list[Hct], list[Hct]]: desired = 14 - filter_enabled = True dislike_filter = True colors_hct = [] @@ -110,6 +109,10 @@ class Score: for i, chosen_hct in enumerate(chosen_colors): chosen_colors[i] = DislikeAnalyzer.fix_if_disliked(chosen_hct) + # Ensure enough colours + if len(chosen_colors) < desired: + return Score.score(colors_to_population, False) + return chosen_primaries, chosen_colors |