Skip to content

Commit

Permalink
Added diagram background color config file option
Browse files Browse the repository at this point in the history
  • Loading branch information
beveradb committed Mar 7, 2024
1 parent b3c8c2e commit 61b3ea3
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 8 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ RUN fc-cache -fv
# Set the working directory
WORKDIR /app

# Install the logo-diagram-generator package
RUN pip install logo-diagram-generator
# Install package globally with pip
COPY . /app
RUN pip install .

# Configure docker to run the logo-diagram-generator
# Configure docker to run the logo-diagram-generator command
ENTRYPOINT ["logo-diagram-generator"]

# Set the default args to pass if none are specified
Expand Down
1 change: 1 addition & 0 deletions examples/full.example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ecosystem:
style:
diagramBackgroundColor: "#ffffff"
diagramEngine: neato
diagramOverlap: prism
diagramOverlapScaling: 4
Expand Down
2 changes: 1 addition & 1 deletion examples/full.example_logos.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/full.example_text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/minimal.example_logos.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/minimal.example_text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions logo_diagram_generator/generate_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def generate_text_only_svg_diagram_from_config(config, diagram_name, output_svg_
diagram_overlap_shrink = str(ecosystem_style.get("diagramOverlapShrink", "true"))
diagram_padding = str(ecosystem_style.get("diagramPadding", "0.5"))
diagram_rankdir = ecosystem_style.get("diagramRankdir", "TB")
diagram_background_color = ecosystem_style.get("diagramBackgroundColor", "#ffffff")

group_label_shape = ecosystem_style.get("groupLabelShape", "box")
group_label_style = ecosystem_style.get("groupLabelStyle", "rounded")
Expand All @@ -35,6 +36,16 @@ def generate_text_only_svg_diagram_from_config(config, diagram_name, output_svg_
dot.attr(rankdir=diagram_rankdir)
dot.attr(pad=diagram_padding)
dot.attr(id=diagram_name)
dot.attr(bgcolor=diagram_background_color)

logging.info(
f"Diagram attributes set: engine={diagram_engine}, overlap={diagram_overlap}, "
f"overlap_scaling={diagram_overlap_scaling}, overlap_shrink={diagram_overlap_shrink}, "
f"rankdir={diagram_rankdir}, padding={diagram_padding}, background_color={diagram_background_color}, "
f"group_label_shape={group_label_shape}, group_label_style={group_label_style}, "
f"group_label_fontname={group_label_fontname}, group_label_fontcolor={group_label_fontcolor}, "
f"group_label_fontsize={group_label_fontsize}, group_label_margin={group_label_margin}"
)

central_tool = config["ecosystem"]["centralTool"]
central_tool_name = central_tool["name"]
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.2.2"
version = "0.2.3"
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 61b3ea3

Please sign in to comment.