summaryrefslogtreecommitdiff
path: root/src/color_engine.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/color_engine.py')
-rw-r--r--src/color_engine.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/color_engine.py b/src/color_engine.py
index 0e43475..bcb3ba2 100644
--- a/src/color_engine.py
+++ b/src/color_engine.py
@@ -26,9 +26,9 @@ def compColors(color_list: list) -> list:
"""
compliments = []
for color in color_list:
- curr_hex = color[1:] # slice off the # from the hex code
+ curr_hex = color[1:]
rgb = (curr_hex[0:2], curr_hex[2:4], curr_hex[4:6])
- comp = ['%02X' % (255 - int(a, 16)) for a in rgb] # magic :D
+ comp = ['%02X' % (255 - int(a, 16)) for a in rgb]
compliments.append('#' + ''.join(comp))
return compliments
@@ -54,7 +54,7 @@ def checkContrast(hex_color_list: list, hex_compliment_list: list) -> list:
def relativeLuminance(color: list):
- threshold = 0.03928 # this whole function is magic constants lol
+ threshold = 0.03928
channels = []
for channel in color:
@@ -70,7 +70,6 @@ def relativeLuminance(color: list):
return luminance
-
def rgbToHex(input_values: list) -> list:
"""
Takes in a list of RBG color values and returns a list of those same colors as hex values
@@ -83,6 +82,7 @@ def rgbToHex(input_values: list) -> list:
hex_list.append('#{:02x}{:02x}{:02x}'.format(red, green, blue))
return hex_list
+
def hexToRGB(hex_value: str) -> tuple:
"""
Takes in a list of Hex values and returns a tuple of those colors as rgb values
@@ -90,6 +90,7 @@ def hexToRGB(hex_value: str) -> tuple:
hex_value = hex_value.lstrip('#')
return tuple(int(hex_value[i:i+2], 16) for i in (0, 2, 4)) # Magic :DDDDDD
+
def hexToRGB_list(hex_list: list) -> list:
colors = []
for color in hex_list: