color_brighter.py 487 Bytes
Newer Older
Leo Jackson's avatar
Leo Jackson committed
1
#!/usr/bin/env python
2 3 4 5
import coloreffect

class C(coloreffect.ColorEffect):
  def colmod(self,r,g,b):
Dmitry Kirsanov's avatar
Dmitry Kirsanov committed
6
    FACTOR=0.9
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
   
    i=int(1.0/(1.0-FACTOR))
    if r==0 and g==0 and b==0:
      return '%02x%02x%02x' % (i,i,i)
    if r>0 and r<i:
      r=i
    if g>0 and g<i:
      g=i
    if b>0 and b<i:
      b=i;

    r=min(int(round((r/FACTOR))), 255)
    g=min(int(round((g/FACTOR))), 255)
    b=min(int(round((b/FACTOR))), 255)
   
    return '%02x%02x%02x' % (r,g,b)

c = C()
c.affect()