Add ability to specify default color
This commit is contained in:
parent
6b3a89edeb
commit
bac99f0d80
@ -67,7 +67,7 @@ class Harness:
|
|||||||
font = 'arial'
|
font = 'arial'
|
||||||
dot.attr('graph', rankdir='LR',
|
dot.attr('graph', rankdir='LR',
|
||||||
ranksep='2',
|
ranksep='2',
|
||||||
bgcolor='white',
|
bgcolor=wv_colors.COLOR_BACKGROUND,
|
||||||
nodesep='0.33',
|
nodesep='0.33',
|
||||||
fontname=font)
|
fontname=font)
|
||||||
dot.attr('node', shape='record',
|
dot.attr('node', shape='record',
|
||||||
@ -302,7 +302,7 @@ class Harness:
|
|||||||
# HTML output
|
# HTML output
|
||||||
with open_file_write(f'{filename}.html') as file:
|
with open_file_write(f'{filename}.html') as file:
|
||||||
file.write('<!DOCTYPE html>\n')
|
file.write('<!DOCTYPE html>\n')
|
||||||
file.write('<html><head><meta charset="UTF-8"></head><body style="font-family:Arial">')
|
file.write(f'<html><head><meta charset="UTF-8"></head><body style="font-family:Arial;background-color:{wv_colors.COLOR_BACKGROUND}">')
|
||||||
|
|
||||||
file.write('<h1>Diagram</h1>')
|
file.write('<h1>Diagram</h1>')
|
||||||
with open_file_read(f'{filename}.svg') as svg:
|
with open_file_read(f'{filename}.svg') as svg:
|
||||||
|
|||||||
@ -98,12 +98,13 @@ _color_ger = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
color_default = '#ffffff'
|
COLOR_DEFAULT = '#ffffff'
|
||||||
|
COLOR_BACKGROUND = '#ffffff'
|
||||||
|
|
||||||
|
|
||||||
def get_color_hex(input, pad=False):
|
def get_color_hex(input, pad=False):
|
||||||
if input is None or input == '':
|
if input is None or input == '':
|
||||||
return [color_default]
|
return [COLOR_DEFAULT]
|
||||||
if len(input) == 4: # give wires with EXACTLY 2 colors that striped/banded look
|
if len(input) == 4: # give wires with EXACTLY 2 colors that striped/banded look
|
||||||
input = input + input[:2]
|
input = input + input[:2]
|
||||||
# hacky style fix: give single color wires a triple-up so that wires are the same size
|
# hacky style fix: give single color wires a triple-up so that wires are the same size
|
||||||
@ -113,7 +114,7 @@ def get_color_hex(input, pad=False):
|
|||||||
output = [_color_hex[input[i:i + 2]] for i in range(0, len(input), 2)]
|
output = [_color_hex[input[i:i + 2]] for i in range(0, len(input), 2)]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("Unknown color specified")
|
print("Unknown color specified")
|
||||||
output = [color_default]
|
output = [COLOR_DEFAULT]
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user