Zemedelphos

cAtrophygradient

Mar 27th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. import math
  2. gradient = ('173220', '5c1910', '7f0c05', 'a10000', 'b30101', 'c50202', 'd40202', 'e20101', 'f10000', 'ff0000')
  3. def gradientmadness(text):
  4.     leng = len(text)
  5.     output = ''
  6.     if leng < 10:
  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 / 10.0))
  16.         for i in range(1, 11):
  17.             output += text[(i-1)*size:i*size] + '</c>'
  18.     return output
  19. gradientmadness.command="cAtrophygradient"
  20. #usage regex replace ^(.*)$ -> cAtrophygradient(\1)
Advertisement
Add Comment
Please, Sign In to add comment