code: def write_transparency(selection):
      
      global themefile, transparency, prefix
  
      if themefile == "":
          return
  
      lines = themefile.split('\n')
  
      for line in lines:
          if 'background' in line.lower():
              try:
                  background = line.split(':')[1].replace(' ', '')
                  background = background.replace('\t', '')
                  break
              except:
                  msg = ('Cannot determine background color from themefile. '
                         'Defaulting to: #000000')
                  print msg
                  background = '#000000'
                  break
          else:
              background = '#000000'
  
      background = hex_to_rgb(background)
  
      fd, tmpfile = tempfile.mkstemp()
      if exists( XRESOURCES ):
          old = open( XRESOURCES )
          new = os.fdopen(fd, 'w')
          for line in old:
              lline = line.lower()
  
              if 'depth' in lline:
                  continue
  
              elif 'rgba' in lline:
                  continue
  
              elif line == '\n':
                  continue
  
              else:
                  os.write(fd, line)
  
          os.write(fd, '\n%s.depth:\t32' % prefix)
          os.write(fd, '\n%s.background:\trgba:%s/%s\n' %
                   (prefix, background, decimal_to_alpha(transparency)))
          old.close()
          new.close()
          move( tmpfile, XRESOURCES )
docs: writes transparency as rgba to ~/.Xresources