Skip to content

Commit

Permalink
Fixed bug with invalid color in dark theme color palette
Browse files Browse the repository at this point in the history
  • Loading branch information
beveradb committed Mar 7, 2024
1 parent 4ee566b commit 4738872
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ config.yml
# Functional outputs
logos/
/*.svg
/*.png

# Misc clutter
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ You can override config entries in the config file from the command-line, using
This is particularly useful if you have a diagram which you want to keep mostly the same but generate multiple slightly different versions of, e.g. a dark themed version:

```bash
logo-diagram-generator -c examples/full.example.yml -o examples -n full.example.dark --override 'style.diagramBackgroundColor=#333333' --override 'style.groupLabelFontcolor=#ffffff' --override 'style.colorPalette=aqua,purple3,maroon3,orangered,yellow,lime,fuchsia,cornflower,peachpuff,forestgreen'
logo-diagram-generator -c examples/full.example.yml -o examples -n full.example.dark --override 'style.diagramBackgroundColor=#333333' --override 'style.groupLabelFontcolor=#ffffff' --override 'style.colorPalette=aqua,purple3,maroon3,orangered,yellow,lime,fuchsia,#6495ed,peachpuff,forestgreen'
```

### Dark / Light Theme
Expand Down
2 changes: 1 addition & 1 deletion logo_diagram_generator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def main():
if args.theme == "dark":
theme_overrides = {
"style.groupLabelFontcolor": "#ffffff",
"style.colorPalette": "aqua,purple3,maroon3,orangered,yellow,lime,fuchsia,cornflower,peachpuff,forestgreen",
"style.colorPalette": "aqua,purple3,maroon3,orangered,yellow,lime,fuchsia,#6495ed,peachpuff,forestgreen",
"style.defaultLogoStrokeColor": "white",
"style.defaultLogoStrokeWidth": "0.5",
}
Expand Down
10 changes: 5 additions & 5 deletions logo_diagram_generator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lime",
"aqua",
"fuchsia",
"cornflower",
"#6495ed",
"yellow",
]

Expand All @@ -37,17 +37,17 @@ def apply_override(config, key_path, value):
key = key_path[0]
if len(key_path) == 1:
if "," in value and (key not in config or isinstance(config.get(key, ""), list)):
# If the value contains a comma and either the key isn't found in the config or the target is a list,
# If the value contains a comma and either the key isn't found in the config or the target is a list,
# assume this config entry is supposed to be a list and split the value.
value = value.split(",")
if key in config:
logging.warning(f"Overriding value of key {key} from {config[key]} to {value}")
logging.info(f"Overriding value of key {key} from {config[key]} to {value}")
else:
logging.warning(f"Key {key} not found in the original config. Adding it with value: {value}")
logging.info(f"Key {key} not found in the original config. Adding it with value: {value}")
config[key] = value
else:
if key not in config or not isinstance(config[key], dict):
logging.warning(f"Creating nested config for key {key} to accommodate override.")
logging.info(f"Creating nested config for key {key} to accommodate override.")
config[key] = {}
apply_override(config[key], key_path[1:], value)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "logo-diagram-generator"
version = "0.3.1"
version = "0.3.2"
description = "Generate SVG diagrams of a (tech) ecosystem, using logos from each tool organised into groups around a central logo"
authors = ["Andrew Beveridge <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 4738872

Please sign in to comment.