make sure only the input and not the padded colors are given in the error message
This commit is contained in:
parent
ade981784c
commit
cd212b8d63
@ -104,15 +104,18 @@ color_default = '#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]
|
padded = input + input[:2]
|
||||||
# hacky style fix: give single color wires a triple-up so that wires are the same size
|
elif pad and len(input) == 2: # hacky style fix: give single color wires a triple-up so that wires are the same size
|
||||||
if pad and len(input) == 2:
|
padded = input + input + input
|
||||||
input = input + input + input
|
else:
|
||||||
|
padded = input
|
||||||
|
|
||||||
try:
|
try:
|
||||||
output = [_color_hex[input[i:i + 2]] for i in range(0, len(input), 2)]
|
output = [_color_hex[padded[i:i + 2]] for i in range(0, len(input), 2)]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print(f"Unknown color specified: {input}")
|
print(f'Unknown color specified: {input}')
|
||||||
output = [color_default]
|
output = [color_default]
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user