Advertisement
LuaDotExe

Rainbow Quirk

Dec 27th, 2015
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. import math
  2. #Rainbow
  3. Rainbow = ('8B00FF','4B0082','00DDFF','00B200','D9D000','FF7F00','FF0000')
  4. def gradientRainbow(text):
  5.     leng = len(text)
  6.     output = ''
  7.     if leng < 7:
  8.         for i in range(0, leng):
  9.             output += '<c=#%s>' % Rainbow[i]
  10.         for i in range(0, leng):
  11.             output += text[i] + '</c>'
  12.     else:
  13.         output += '<c=#'
  14.         output += '><c=#'.join(Rainbow)
  15.         output += '>'
  16.         size = int(math.ceil(leng / 7.0))
  17.         for i in range(1, 8):
  18.             output += text[(i-1)*size:i*size] + '</c>'
  19.     return output
  20. gradientRainbow.command="Rainbow"
  21. #usage regex replace ^(.*)$ -> functionname(\1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement