Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Gradientify

By: a guest on Aug 25th, 2011  |  syntax: None  |  size: 0.82 KB  |  views: 2,270  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import math
  2. gradient = ('F20904', 'F86800', 'FBD101', '5BFF00', '6677FF', '0000C7', '6611FF')
  3. def gradientmadness(text):
  4.     leng = len(text)
  5.     output = ''
  6.     if leng < 7:
  7.         for i in range(0, leng):
  8.             output += '<c=#%s>' % gradient[i]
  9.         for i in range(0, leng):
  10.             output += text[i] + '</c>'
  11.     else:
  12.         output += '<c=#'
  13.         output += '><c=#'.join(gradient)
  14.         output += '>'
  15.         size = int(math.ceil(leng / 7.0))
  16.         for i in range(1, 8):
  17.             output += text[(i-1)*size:i*size] + '</c>'
  18.     return output
  19. gradientmadness.command="gradientify"
  20. #usage regex replace ^(.*)$ -> gradientify(\1)
  21.  
  22.  
  23.  
  24. save it as gradient.py put in the "quirks" folder in Pesterchum.
  25.  
  26.  
  27.  
  28. You have to put (.*) into the Regexp box, then gradientify(\1) into Replace with box.