From: David Mazary Date: Sun, 18 Mar 2012 19:22:29 +0000 (-0300) Subject: normalize from 255 to 1 correctly :) X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=df368c515abac0855b0a38008256787bbc2989e0;p=xonotic%2Fxonstat.git normalize from 255 to 1 correctly :) --- diff --git a/xonstat/util.py b/xonstat/util.py index e88c6b3..2b1582d 100755 --- a/xonstat/util.py +++ b/xonstat/util.py @@ -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