diff --git a/website/utils.py b/website/utils.py index c7fe2f697fc..39e30bad07d 100644 --- a/website/utils.py +++ b/website/utils.py @@ -309,10 +309,6 @@ def url_for_website(url): return url def get_hex_shade(color, percent): - # switch dark and light shades - if int(color, 16) > int("808080", 16): - percent = -percent - # stronger diff for darker shades if int(color, 16) < int("333333", 16): percent = percent * 2 @@ -329,4 +325,11 @@ def get_hex_shade(color, percent): return h r, g, b = color[0:2], color[2:4], color[4:6] - return p(r) + p(g) + p(b) \ No newline at end of file + + # switch dark and light shades + if float(int(r, 16) + int(g, 16) + int(b, 16)) / 3 < 8: + percent = -percent + + return p(r) + p(g) + p(b) + + \ No newline at end of file