From: Ant Zucaro Date: Sun, 18 Mar 2012 20:07:03 +0000 (-0400) Subject: Cap RGB value darkness by first converting to HSL, then applying threshold. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8bda3065e1f4ab28e05caf668199a80053a2dcfc;p=xonotic%2Fxonstat.git Cap RGB value darkness by first converting to HSL, then applying threshold. RGB values that were too dark to read against a black background are now viewable. This is done by converting the RGB values (from the hex values provided) to HSL, then moving any L (lightness) values beyond a certain threshold back. Finally they are converted back to RGB for display. In practice all this really does is to lighten the dark colors without changing their hue or saturation values (e.g. black becomes gray). Thanks go to dmazary for helping me with this and working through the various bugs I found. Thanks, Dave! --- diff --git a/xonstat/util.py b/xonstat/util.py index de5153a..1db7770 100755 --- a/xonstat/util.py +++ b/xonstat/util.py @@ -42,16 +42,16 @@ _qfont_table = [ # Hex-colored spans for decimal color codes ^0 - ^9 _dec_spans = [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" ] # Color code patterns