Skip to content

Commit

Permalink
Add bgcolor_node option
Browse files Browse the repository at this point in the history
It is default white unless set to a different color, or equal
bgcolor (as if transparent) if set to ~, null, Null, or NULL.
  • Loading branch information
kvid committed Feb 25, 2021
1 parent 2f57999 commit 75a9a75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/wireviz/DataClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Metadata:
class Options:
fontname: PlainText = 'arial'
bgcolor: Color = 'WH'
bgcolor_node: Optional[Color] = 'WH'
color_mode: ColorMode = 'SHORT'
mini_bom_mode: bool = True

Expand Down
11 changes: 5 additions & 6 deletions src/wireviz/Harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ def create_graph(self) -> Graph:
bgcolor=wv_colors.translate_color(self.options.bgcolor, "HEX"),
nodesep='0.33',
fontname=self.options.fontname)
# Currently, size and fontname seem to be the only of these node attributes not overridden for each node.
dot.attr('node', shape='record',
dot.attr('node',
shape='none',
width='0', height='0', margin='0', # Actual size of the node is entirely determined by the label.
style='filled',
fillcolor='white',
fillcolor=wv_colors.translate_color(self.options.bgcolor_node or self.options.bgcolor, "HEX"),
fontname=self.options.fontname)
dot.attr('edge', style='bold',
fontname=self.options.fontname)
Expand Down Expand Up @@ -163,7 +163,7 @@ def create_graph(self) -> Graph:
html = [row.replace('<!-- connector table -->', '\n'.join(pinhtml)) for row in html]

html = '\n'.join(html)
dot.node(connector.name, label=f'<\n{html}\n>', shape='none', margin='0', style='filled', fillcolor='white')
dot.node(connector.name, label=f'<\n{html}\n>')

if len(connector.loops) > 0:
dot.attr('edge', color='#000000:#ffffff:#000000')
Expand Down Expand Up @@ -332,8 +332,7 @@ def create_graph(self) -> Graph:

html = '\n'.join(html)
dot.node(cable.name, label=f'<\n{html}\n>', shape='box',
style='filled,dashed' if cable.category == 'bundle' else 'filled',
margin='0', fillcolor='white')
style='filled,dashed' if cable.category == 'bundle' else 'filled')

return dot

Expand Down

0 comments on commit 75a9a75

Please sign in to comment.