mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-08 22:01:51 +02:00
Issue #91: support automatic icon generation.
Use regular expressions to match tags and construct icons using matched substrings.
This commit is contained in:
parent
4644d38166
commit
39acfc6ff6
4 changed files with 102 additions and 88 deletions
|
@ -50,12 +50,13 @@ class IconCollection:
|
|||
"""
|
||||
icons: list[Icon] = []
|
||||
|
||||
def add() -> Icon:
|
||||
def add() -> Optional[Icon]:
|
||||
"""Construct icon and add it to the list."""
|
||||
specifications: list[ShapeSpecification] = [
|
||||
scheme.get_shape_specification(x, extractor)
|
||||
for x in current_set
|
||||
]
|
||||
specifications: list[ShapeSpecification] = []
|
||||
for shape_specification in current_set:
|
||||
if "#" in shape_specification["shape"]:
|
||||
return None
|
||||
scheme.get_shape_specification(shape_specification, extractor)
|
||||
constructed_icon: Icon = Icon(specifications)
|
||||
constructed_icon.recolor(color, white=background_color)
|
||||
if constructed_icon not in icons:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue