parameters: (self, css, factor)
return_statement: return css
docstring: Apply a fake transparency to color.
  
          Fake transparency is preformed on top of the background color.
docstring_summary: Apply a fake transparency to color.
docstring_tokens: Apply a fake transparency to color .
function: def fade(self, css, factor):
          """
          Apply a fake transparency to color.
  
          Fake transparency is preformed on top of the background color.
          """
          try:
              parts = [c.strip('; ') for c in css.split(':')]
              if len(parts) == 2 and parts[0] in ('background-color', 'color'):
                  bgcolor = self.colors.get('.background').get('background-color')
                  bgparts = [c.strip('; ') for c in bgcolor.split(':')]
                  rgba = RGBA(parts[1] + "%02f" % int(255.0 * max(min(float(factor), 1.0), 0.0)))
                  rgba.apply_alpha(bgparts[1])
                  return '%s: %s; ' % (parts[0], rgba.get_rgb())
          except Exception:
              pass
          return css
function_tokens: def fade ( self , css , factor ) : try : parts = [ c . strip ( '; ' ) for c in css . split ( ':' ) ] if len ( parts ) == 2 and parts [ 0 ] in ( 'background-color' , 'color' ) : bgcolor = self . colors . get ( '.background' ) . get ( 'background-color' ) bgparts = [ c . strip ( '; ' ) for c in bgcolor . split ( ':' ) ] rgba = RGBA ( parts [ 1 ] + "%02f" % int ( 255.0 * max ( min ( float ( factor ) , 1.0 ) , 0.0 ) ) ) rgba . apply_alpha ( bgparts [ 1 ] ) return '%s: %s; ' % ( parts [ 0 ] , rgba . get_rgb ( ) ) except Exception : pass return css