]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
normalize from 255 to 1 correctly :)
authorDavid Mazary <dmazary@gmail.com>
Sun, 18 Mar 2012 19:22:29 +0000 (16:22 -0300)
committerDavid Mazary <dmazary@gmail.com>
Sun, 18 Mar 2012 19:22:29 +0000 (16:22 -0300)
xonstat/util.py

index e88c6b35942b1ac5af3bb8fbc2fec9ba9bdd7121..2b1582d1ade790ccecb14ecacbdc05dcd4040414 100755 (executable)
@@ -84,9 +84,9 @@ def strip_colors(qstr=''):
     
 def hex_repl(match):
     # Convert hex to 8 bits and to 0.0-1.0 scale
-    r = 255. / int(match.group(1) * 2, 16)
-    g = 255. / int(match.group(2) * 2, 16)
-    b = 255. / int(match.group(3) * 2, 16)
+    r = int(match.group(1) * 2, 16) / 255.
+    g = int(match.group(2) * 2, 16) / 255.
+    b = int(match.group(3) * 2, 16) / 255.
     hue, light, satur = rgb_to_hls(r, g, b)
     if light < _contrast_threshold:
         light = _contrast_threshold