From 1aab4eaf8d8c1a4c641acfbe1b4a00d2fa6938d2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 14 Mar 2013 15:06:44 +0530 Subject: [PATCH] website module: minor updates --- website/utils.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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