website module: minor updates

This commit is contained in:
Rushabh Mehta 2013-03-14 15:06:44 +05:30
parent ebee1c7033
commit 1aab4eaf8d

View File

@ -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)
# 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)