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 2f579995fd
commit 75a9a758a8
2 changed files with 6 additions and 6 deletions

View File

@ -42,6 +42,7 @@ class Metadata:
class Options: class Options:
fontname: PlainText = 'arial' fontname: PlainText = 'arial'
bgcolor: Color = 'WH' bgcolor: Color = 'WH'
bgcolor_node: Optional[Color] = 'WH'
color_mode: ColorMode = 'SHORT' color_mode: ColorMode = 'SHORT'
mini_bom_mode: bool = True mini_bom_mode: bool = True

View File

@ -95,11 +95,11 @@ class Harness:
bgcolor=wv_colors.translate_color(self.options.bgcolor, "HEX"), bgcolor=wv_colors.translate_color(self.options.bgcolor, "HEX"),
nodesep='0.33', nodesep='0.33',
fontname=self.options.fontname) 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',
dot.attr('node', shape='record', shape='none',
width='0', height='0', margin='0', # Actual size of the node is entirely determined by the label. width='0', height='0', margin='0', # Actual size of the node is entirely determined by the label.
style='filled', style='filled',
fillcolor='white', fillcolor=wv_colors.translate_color(self.options.bgcolor_node or self.options.bgcolor, "HEX"),
fontname=self.options.fontname) fontname=self.options.fontname)
dot.attr('edge', style='bold', dot.attr('edge', style='bold',
fontname=self.options.fontname) fontname=self.options.fontname)
@ -163,7 +163,7 @@ class Harness:
html = [row.replace('<!-- connector table -->', '\n'.join(pinhtml)) for row in html] html = [row.replace('<!-- connector table -->', '\n'.join(pinhtml)) for row in html]
html = '\n'.join(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: if len(connector.loops) > 0:
dot.attr('edge', color='#000000:#ffffff:#000000') dot.attr('edge', color='#000000:#ffffff:#000000')
@ -332,8 +332,7 @@ class Harness:
html = '\n'.join(html) html = '\n'.join(html)
dot.node(cable.name, label=f'<\n{html}\n>', shape='box', dot.node(cable.name, label=f'<\n{html}\n>', shape='box',
style='filled,dashed' if cable.category == 'bundle' else 'filled', style='filled,dashed' if cable.category == 'bundle' else 'filled')
margin='0', fillcolor='white')
return dot return dot