Add bgcolor_node option

It is default white unless set to a different color, or equal
bgcolor (as if transparent) if set to ~, null, Null, or NULL.
This commit is contained in:
KV 2021-02-26 00:34:20 +01:00
parent 84772fca91
commit d5c69116ea
2 changed files with 6 additions and 6 deletions

View File

@ -43,6 +43,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

View File

@ -98,11 +98,11 @@ class Harness:
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)
@ -170,7 +170,7 @@ class Harness:
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')
@ -339,8 +339,7 @@ class Harness:
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