diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-05-17 16:33:34 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-05-17 16:33:34 (GMT) |
commit | 88b80c145bc8b83b9ef6bcd39193b5331f5556bc (patch) | |
tree | cae0266f19c77a5dd0f98d22c06d42ee2584ffd5 | |
parent | 86996bb6a36241596a7699224580301a6a4fbe2d (diff) |
fixed bug in parsing colors during luminance calculation
-rw-r--r-- | utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -32,12 +32,13 @@ def get_path(activity, subpath): def _luminance(color): ''' Calculate luminance value ''' - return int(color[0:2], 16) * 0.3 + int(color[2:4], 16) * 0.6 + int(color[4:6]) * 0.1 + return int(color[1:3], 16) * 0.3 + int(color[3:5], 16) * 0.6 + \ + int(color[5:7], 16) * 0.1 def lighter_color(colors): ''' Which color is lighter? Use that one for the text background ''' - if _luminance(colors[0][1:6]) > _luminance(colors[1][1:6]): + if _luminance(colors[0]) > _luminance(colors[1]): return 0 return 1 |