1 import coloreffect
3 class C(coloreffect.ColorEffect):
4 def colmod(self,r,g,b):
5 FACTOR=0.9
7 i=int(1.0/(1.0-FACTOR))
8 if r==0 and g==0 and b==0:
9 return '%02x%02x%02x' % (i,i,i)
10 if r>0 and r<i:
11 r=i
12 if g>0 and g<i:
13 g=i
14 if b>0 and b<i:
15 b=i;
17 r=min(int(round((r/FACTOR))), 255)
18 g=min(int(round((g/FACTOR))), 255)
19 b=min(int(round((b/FACTOR))), 255)
21 return '%02x%02x%02x' % (r,g,b)
23 c = C()
24 c.affect()