From afb050c2b07097a196ed6c5697ae64b8a14a8b9b Mon Sep 17 00:00:00 2001 From: Sergey Vartanov Date: Wed, 17 Aug 2022 09:36:04 +0300 Subject: [PATCH] Issue #140: fix default colors in scheme. --- CHANGELOG.md | 10 +++++++--- map_machine/__init__.py | 2 +- map_machine/scheme.py | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b5e858..61d5c0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,16 @@ -# Unreleased +# 0.1.7 + +_17 August 2022_ -- Redraw diving tower icons. - Add icons for: - `shop=car_parts`, `shop=variety_store` (#48), - `natural=spring` (#55), - `tomb=pyramid`. - Reuse icon for `shop=department_store` (#48). -- Redraw fountain icons. +- Fix style for `indoor=room` (#139). +- Redraw diving tower and fountain icons. +- Add `--scheme` option (#140). +- Rename `element` command to `draw` and change format. # 0.1.6 diff --git a/map_machine/__init__.py b/map_machine/__init__.py index 9830bad..2edb61c 100644 --- a/map_machine/__init__.py +++ b/map_machine/__init__.py @@ -9,7 +9,7 @@ __doc_url__ = f"{__url__}/blob/main/README.md" __author__ = "Sergey Vartanov" __email__ = "me@enzet.ru" -__version__ = "0.1.6" +__version__ = "0.1.7" from pathlib import Path diff --git a/map_machine/scheme.py b/map_machine/scheme.py index cbfdd0b..fe370d0 100644 --- a/map_machine/scheme.py +++ b/map_machine/scheme.py @@ -27,6 +27,8 @@ IconDescription = list[Union[str, dict[str, str]]] +DEFAULT_COLOR: Color = Color("black") + @dataclass class LineStyle: @@ -397,7 +399,9 @@ def get_color(self, color: str) -> Color: return Color(color) except (ValueError, AttributeError): logging.debug(f"Unknown color `{color}`.") - return Color(self.colors["default"]) + if "default" in self.colors: + return Color(self.colors["default"]) + return DEFAULT_COLOR def get_default_color(self) -> Color: """Get default color for a main icon."""