mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-06 12:51:53 +02:00
Support darken color.
This commit is contained in:
parent
496d663526
commit
245c316997
2 changed files with 10 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue