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
5aac2ba8f3
commit
22f20e2950
@ -42,6 +42,7 @@ class Metadata:
|
|||||||
@dataclass
|
@dataclass
|
||||||
class Options:
|
class Options:
|
||||||
fontname: PlainText = 'arial'
|
fontname: PlainText = 'arial'
|
||||||
|
bgcolor: Color = 'WH'
|
||||||
color_mode: ColorMode = 'SHORT'
|
color_mode: ColorMode = 'SHORT'
|
||||||
mini_bom_mode: bool = True
|
mini_bom_mode: bool = True
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ class Harness:
|
|||||||
dot.body.append(f'// {APP_URL}')
|
dot.body.append(f'// {APP_URL}')
|
||||||
dot.attr('graph', rankdir='LR',
|
dot.attr('graph', rankdir='LR',
|
||||||
ranksep='2',
|
ranksep='2',
|
||||||
bgcolor='white',
|
bgcolor=wv_colors.translate_color(self.options.bgcolor, "HEX"),
|
||||||
nodesep='0.33',
|
nodesep='0.33',
|
||||||
fontname=self.options.fontname)
|
fontname=self.options.fontname)
|
||||||
dot.attr('node', shape='record',
|
dot.attr('node', shape='record',
|
||||||
|
|||||||
@ -5,7 +5,7 @@ from pathlib import Path
|
|||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
import re
|
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.DataClasses import Metadata, Options
|
||||||
from wireviz.wv_helper import flatten2d, open_file_read, open_file_write
|
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(' <meta charset="UTF-8">\n')
|
||||||
file.write(f' <meta name="generator" content="{APP_NAME} {__version__} - {APP_URL}">\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' <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')
|
file.write(f'<h1>{metadata.title}</h1>\n')
|
||||||
if metadata.description:
|
if metadata.description:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user