forked from Shinonome/caelestia-cli
score: fix for low contrast wallpapers
This commit is contained in:
@@ -20,7 +20,7 @@ class Score:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def score(colors_to_population: dict, filter_enabled: bool = True) -> tuple[list[Hct], list[Hct]]:
|
def score(colors_to_population: dict, filter_enabled: bool = False) -> tuple[list[Hct], list[Hct]]:
|
||||||
desired = 14
|
desired = 14
|
||||||
dislike_filter = True
|
dislike_filter = True
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ class Score:
|
|||||||
|
|
||||||
# Choose distinct colours
|
# Choose distinct colours
|
||||||
chosen_colors = []
|
chosen_colors = []
|
||||||
for difference_degrees_ in range(90, 0, -1):
|
for difference_degrees_ in range(90, -1, -1):
|
||||||
chosen_colors.clear()
|
chosen_colors.clear()
|
||||||
for item in scored_hct:
|
for item in scored_hct:
|
||||||
hct = item["hct"]
|
hct = item["hct"]
|
||||||
@@ -78,7 +78,7 @@ class Score:
|
|||||||
|
|
||||||
# Get primary colour
|
# Get primary colour
|
||||||
primary = None
|
primary = None
|
||||||
for cutoff in range(20, 0, -1):
|
for cutoff in range(20, -1, -1):
|
||||||
for item in scored_hct:
|
for item in scored_hct:
|
||||||
if item["hct"].chroma > cutoff and item["hct"].tone > cutoff * 3:
|
if item["hct"].chroma > cutoff and item["hct"].tone > cutoff * 3:
|
||||||
primary = item["hct"]
|
primary = item["hct"]
|
||||||
@@ -86,6 +86,10 @@ class Score:
|
|||||||
if primary:
|
if primary:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Ensure primary exists
|
||||||
|
if not primary:
|
||||||
|
return Score.score(colors_to_population, False)
|
||||||
|
|
||||||
# Choose distinct primaries
|
# Choose distinct primaries
|
||||||
chosen_primaries = [primary]
|
chosen_primaries = [primary]
|
||||||
for difference_degrees_ in range(90, 14, -1):
|
for difference_degrees_ in range(90, 14, -1):
|
||||||
|
|||||||
Reference in New Issue
Block a user