Merge branch 'refactor/add-default-color-param' into refactor/csv-tsv

This commit is contained in:
Andrew Katz 2020-07-24 16:01:50 -04:00
commit e207ee23ea
2 changed files with 6 additions and 5 deletions

View File

@ -67,7 +67,7 @@ class Harness:
font = 'arial'
dot.attr('graph', rankdir='LR',
ranksep='2',
bgcolor='white',
bgcolor=wv_colors.COLOR_BACKGROUND,
nodesep='0.33',
fontname=font)
dot.attr('node', shape='record',
@ -302,7 +302,7 @@ class Harness:
# HTML output
with open_file_write(f'{filename}.html') as file:
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>')
with open_file_read(f'{filename}.svg') as svg:

View File

@ -98,12 +98,13 @@ _color_ger = {
}
color_default = '#ffffff'
COLOR_DEFAULT = '#ffffff'
COLOR_BACKGROUND = '#ffffff'
def get_color_hex(input, pad=False):
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
input = input + input[:2]
# 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)]
except KeyError:
print("Unknown color specified")
output = [color_default]
output = [COLOR_DEFAULT]
return output