Add bgcolor option
The same color value is used for html.body.style.background-color and gv.graph.bgcolor to make the diagram fit seamlessly in the HTML output. "bgcolor" is chosen as option name to avoid the dash in the CSS name "background-color".
This commit is contained in:
parent
35cb8a2c94
commit
1227915de5
@ -41,6 +41,7 @@ class Metadata:
|
||||
@dataclass
|
||||
class Options:
|
||||
fontname: PlainText = 'arial'
|
||||
bgcolor: Color = 'WH'
|
||||
color_mode: ColorMode = 'SHORT'
|
||||
mini_bom_mode: bool = True
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ class Harness:
|
||||
dot.body.append(f'// {APP_URL}')
|
||||
dot.attr('graph', rankdir='LR',
|
||||
ranksep='2',
|
||||
bgcolor='white',
|
||||
bgcolor=wv_colors.translate_color(self.options.bgcolor, "HEX"),
|
||||
nodesep='0.33',
|
||||
fontname=self.options.fontname)
|
||||
dot.attr('node', shape='record',
|
||||
|
||||
@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from typing import List, Union
|
||||
import re
|
||||
|
||||
from wireviz import __version__, APP_NAME, APP_URL
|
||||
from wireviz import __version__, APP_NAME, APP_URL, wv_colors
|
||||
from wireviz.DataClasses import Metadata, Options
|
||||
from wireviz.wv_helper import flatten2d, open_file_read, open_file_write
|
||||
|
||||
@ -16,7 +16,8 @@ def generate_html_output(filename: Union[str, Path], bom_list: List[List[str]],
|
||||
file.write(' <meta charset="UTF-8">\n')
|
||||
file.write(f' <meta name="generator" content="{APP_NAME} {__version__} - {APP_URL}">\n')
|
||||
file.write(f' <title>{metadata.title}</title>\n')
|
||||
file.write(f'</head><body style="font-family:{options.fontname}">\n')
|
||||
file.write(f'</head><body style="font-family:{options.fontname};background-color:'
|
||||
f'{wv_colors.translate_color(options.bgcolor, "HEX")}">\n')
|
||||
|
||||
file.write(f'<h1>{metadata.title}</h1>\n')
|
||||
if metadata.description:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user