1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
This commit is contained in:
Jeremy Stretch
2017-05-15 13:18:49 -04:00
parent a49521d683
commit aa6ca21a34

View File

@@ -31,7 +31,7 @@ def foreground_color(bg_color):
Return the ideal foreground color (black or white) for a given background color in hexadecimal RGB format.
"""
bg_color = bg_color.strip('#')
r, g, b = [int(bg_color[c:c+2], 16) for c in (0, 2, 4)]
r, g, b = [int(bg_color[c:c + 2], 16) for c in (0, 2, 4)]
if r * 0.299 + g * 0.587 + b * 0.114 > 186:
return '000000'
else: