Issue #91: support automatic icon generation.

Use regular expressions to match tags and construct icons using matched
substrings.
This commit is contained in:
Sergey Vartanov 2021-09-26 18:23:22 +03:00
parent 4644d38166
commit 39acfc6ff6
4 changed files with 102 additions and 88 deletions

View file

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