Advertisement
Hydrothermal

Pesterchum gradient

Sep 28th, 2013
2,759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.81 KB | None | 0 0
  1. #1) Copy and paste the following into notepad:
  2. import math
  3. colors = ("0000FF", "000FFF", "00FF00", "FFF000", "FF0000")
  4. def gradient(text):
  5.     count = len(colors)
  6.     leng = len(text)
  7.     output = ""
  8.     if leng < count:
  9.         for i in range(0, leng):
  10.             output += "<c=#%s>" % colors[i]
  11.         for i in range(0, leng):
  12.             output += text[i] + "</c>"
  13.     else:
  14.         output += "<c=#" + "><c=#".join(colors) + ">"
  15.         size = int(math.ceil(leng / float(count)))
  16.         for i in range(1, count + 1):
  17.             output += text[(i - 1) * size:i * size] + "</c>"
  18.     return output
  19. gradient.command = "functionname"
  20.  
  21. #2) Replace the list on the second line with the list of colors you want to use in reverse order. Use hex codes WITHOUT the hash signs in front. For example, to produce a colors going from #FF0000 to #0000FF:
  22. colors = ("0000FF", "000FFF", "00FF00", "FFF000", "FF0000")
  23.  
  24. #3) Replace "functionname" with whatever you want to name your quirk. Saving it as the name of the handle you intend to use it for might be a good idea, but anything works.
  25.  
  26. #4) Save your file as a .py file in the quirks folder in your pesterchum folder. The filename doesn't matter as long as it ends in .py.
  27. #   On Windows 7, your pesterchum folder is C:\Users\<name>\AppData\Local\pesterchum, replacing <name> with your username.
  28.  
  29. #5) Go to Pesterchum and add a new Regexp Replace quirk. Click "RELOAD FUNCTIONS" and you should see your function appear in the list. Enter "^(.*)$" without the quotes into the Regexp box and functionname(\1) into the Replace With box, changing "functionname" to the name of your function.
  30.  
  31. #6) Click Finish and test your quirk.
  32.  
  33. # If you have any questions or comments, drop a post in the Pesterchum thread on the forums (http://omegaupdate.freeforums.net/thread/80/pesterchum).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement