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:
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:

View file

@ -86,7 +86,7 @@ colors:
slate_blue: "#6A5ACD" # W3C slateblue
carto_colors:
building_border_color: {color: building_color, darken: "15%"}
building_border_color: {color: building_color, darken: 0.15}
building_color: "#d9d0c9"
cemetery_color: "#aacbaf"
commercial_color: "#f2dad9"