forked from Shinonome/caelestia-cli
scheme: ensure enough colours
This commit is contained in:
@@ -20,9 +20,8 @@ class Score:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@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
|
desired = 14
|
||||||
filter_enabled = True
|
|
||||||
dislike_filter = True
|
dislike_filter = True
|
||||||
|
|
||||||
colors_hct = []
|
colors_hct = []
|
||||||
@@ -110,6 +109,10 @@ class Score:
|
|||||||
for i, chosen_hct in enumerate(chosen_colors):
|
for i, chosen_hct in enumerate(chosen_colors):
|
||||||
chosen_colors[i] = DislikeAnalyzer.fix_if_disliked(chosen_hct)
|
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
|
return chosen_primaries, chosen_colors
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user