Cleaned up wv_colors.py

*Reformatted with autopep8
*renamed input->inp to avoid shadowing input() function
This commit is contained in:
Gabe R 2020-06-28 23:52:52 -05:00
parent 854f06dd79
commit 9cb3608b27
No known key found for this signature in database
GPG Key ID: F96D83D8D7ED67D0

View File

@ -1,8 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
COLOR_CODES = {
'DIN': ['WH','BN','GN','YE','GY','PK','BU','RD','BK','VT'], # ,'GYPK','RDBU','WHGN','BNGN','WHYE','YEBN','WHGY','GYBN','WHPK','PKBN'],
'IEC': ['BN','RD','OG','YE','GN','BU','VT','GY','WH','BK'],
'BW': ['BK','WH']
}
# ,'GYPK','RDBU','WHGN','BNGN','WHYE','YEBN','WHGY','GYBN','WHPK','PKBN'],
'DIN': ['WH', 'BN', 'GN', 'YE', 'GY', 'PK', 'BU', 'RD', 'BK', 'VT'],
'IEC': ['BN', 'RD', 'OG', 'YE', 'GN', 'BU', 'VT', 'GY', 'WH', 'BK'],
'BW': ['BK', 'WH'],
}
color_hex = {
'BK': '#000000',
@ -17,7 +20,7 @@ color_hex = {
'BU': '#0066ff',
'VT': '#8000ff',
'BN': '#666600',
}
}
color_full = {
'BK': 'black',
@ -49,26 +52,27 @@ color_ger = {
'BN': 'br',
}
def translate_color(input, color_mode):
if input == '':
def translate_color(inp, color_mode):
if inp == '':
output = ''
else:
if color_mode == 'full':
output = color_full[input].lower()
output = color_full[inp].lower()
elif color_mode == 'FULL':
output = color_full[input].upper()
output = color_full[inp].upper()
elif color_mode == 'hex':
output = color_hex[input].lower()
output = color_hex[inp].lower()
elif color_mode == 'HEX':
output = color_hex[input].upper()
output = color_hex[inp].upper()
elif color_mode == 'ger':
output = color_ger[input].lower()
output = color_ger[inp].lower()
elif color_mode == 'GER':
output = color_ger[input].upper()
output = color_ger[inp].upper()
elif color_mode == 'short':
output = input.lower()
output = inp.lower()
elif color_mode == 'SHORT':
output = input.upper()
output = inp.upper()
else:
raise Exception('Unknown color mode')
return output