Support darken color.

This commit is contained in:
Sergey Vartanov 2021-10-05 09:13:58 +03:00
parent 496d663526
commit 245c316997
2 changed files with 10 additions and 2 deletions

View file

@ -362,7 +362,15 @@ class Scheme:
:return: color specification
"""
if color in self.colors:
return Color(self.colors[color])
specification = self.colors[color]
if isinstance(specification, str):
return Color(self.colors[color])
else:
color: Color = self.get_color(specification["color"])
if "darken" in specification:
percent: float = float(specification["darken"])
color.set_luminance(color.get_luminance() * (1 - percent))
return color
if color.lower() in self.colors:
return Color(self.colors[color.lower()])
try: