Minor improvements to the badges generator:
authorJan D. Behrens <zykure@web.de>
Fri, 14 Sep 2012 20:03:03 +0000 (22:03 +0200)
committerJan D. Behrens <zykure@web.de>
Fri, 14 Sep 2012 20:03:03 +0000 (22:03 +0200)
- Fixed mistake int the ^6 color code (leading to wrong colors)
- Extended the playernick down-scaling for too wide nicks (now max. down-scaling is based on fontsize)

xonstat/batch/badges/skin.py

index 56bc1d09b3bdbc1cb73e890c2aa43b48813ac216..399bb7989a025a4eeec7068f3c6f5abf3a7cdeaa 100644 (file)
@@ -15,7 +15,7 @@ _dec_colors = [ (0.5,0.5,0.5),
                 (1.0,1.0,0.0),
                 (0.2,0.4,1.0),
                 (0.2,1.0,1.0),
-                (1.0,0.2,102),
+                (1.0,0.2,0.4),
                 (1.0,1.0,1.0),
                 (0.6,0.6,0.6),
                 (0.5,0.5,0.5)
@@ -266,11 +266,11 @@ class Skin:
         # fontsize is reduced if width gets too large
         ctx.select_font_face(self.font, C.FONT_SLANT_NORMAL, C.FONT_WEIGHT_NORMAL)
         shrinknick = 0
-        while shrinknick < 10:
+        while shrinknick < 0.6*fontsize:
             ctx.set_font_size(self.nick_fontsize - shrinknick)
             xoff, yoff, tw, th = ctx.text_extents(stripped_nick)[:4]
             if tw > self.nick_maxwidth:
-                shrinknick += 2
+                shrinknick += 1
                 continue
             break