mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-09 06:11:54 +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
|
:return: color specification
|
||||||
"""
|
"""
|
||||||
if color in self.colors:
|
if color in self.colors:
|
||||||
|
specification = self.colors[color]
|
||||||
|
if isinstance(specification, str):
|
||||||
return Color(self.colors[color])
|
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:
|
if color.lower() in self.colors:
|
||||||
return Color(self.colors[color.lower()])
|
return Color(self.colors[color.lower()])
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -86,7 +86,7 @@ colors:
|
||||||
slate_blue: "#6A5ACD" # W3C slateblue
|
slate_blue: "#6A5ACD" # W3C slateblue
|
||||||
|
|
||||||
carto_colors:
|
carto_colors:
|
||||||
building_border_color: {color: building_color, darken: "15%"}
|
building_border_color: {color: building_color, darken: 0.15}
|
||||||
building_color: "#d9d0c9"
|
building_color: "#d9d0c9"
|
||||||
cemetery_color: "#aacbaf"
|
cemetery_color: "#aacbaf"
|
||||||
commercial_color: "#f2dad9"
|
commercial_color: "#f2dad9"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue