website module: minor updates
This commit is contained in:
parent
ebee1c7033
commit
1aab4eaf8d
@ -309,10 +309,6 @@ def url_for_website(url):
|
|||||||
return url
|
return url
|
||||||
|
|
||||||
def get_hex_shade(color, percent):
|
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
|
# stronger diff for darker shades
|
||||||
if int(color, 16) < int("333333", 16):
|
if int(color, 16) < int("333333", 16):
|
||||||
percent = percent * 2
|
percent = percent * 2
|
||||||
@ -329,4 +325,11 @@ def get_hex_shade(color, percent):
|
|||||||
return h
|
return h
|
||||||
|
|
||||||
r, g, b = color[0:2], color[2:4], color[4:6]
|
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)
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user