Guest User

Gradience

a guest
Apr 18th, 2015
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.25 KB | None | 0 0
  1. """
  2. For this file to work properly, you should please read all the comments.
  3. Comments are enclosed in " " " marks (without spaces), like this one.
  4.  
  5. Place this file in the Pesterchum quirks folder, which is usually
  6. C:\Pesterchum\quirks for Windows.
  7. Remember to set the file type as "All" and the extension to .py
  8.  
  9. Please read thoroughly.
  10. If you have any questions, ask someone who knows about gradients.
  11. """
  12. from math import ceil
  13.  
  14. gradient = ('COLOR 1', 'COLOR 2')
  15. """
  16. Put the colors you want up there, in CORRECT order. They must be in RRGGBB HEXADECIMAL format.
  17. If you don't know what that is, look it up on Google and have your color values converted there.
  18.  
  19. Remember to enclose each color value in single quotes and separate the color values with commas.
  20. """
  21. colors = 2
  22. """
  23. Change this value to the number of colors you have in your gradient.
  24. If this number does not match the number of colors you have entered in the gradient,
  25. it will either show up as incomplete or cause an error.
  26. """
  27.  
  28. def gradientmadness(text):
  29.     leng = len(text)
  30.     output = ''
  31.    
  32.     if leng < colors:
  33.         for i in range(0, leng):
  34.             output += '<c=#%s>' % gradient[colors - 1 - i]
  35.         for i in range(0, leng):
  36.             output += text[i] + '</c>'
  37.     else:
  38.         for i in range(0, colors):
  39.             output += '<c=#' + gradient[colors - 1 - i] + '>'
  40.  
  41.         size = int(ceil(leng / float(colors)))
  42.         for i in range(1, colors + 1):
  43.             output += text[(i-1)*size:i*size] + '</c>'
  44.            
  45.     return output
  46. """
  47. Don't do anything to this part of the code unless you know what you're doing.
  48. You'll break the gradient function.
  49. """
  50.    
  51.    
  52. gradientmadness.command="gradientname"
  53. """
  54. Between the double quotes above, insert the name of your gradience function
  55.  
  56. To use in the quirks menu:
  57. regex replace ^(.*)$
  58. and replace it with
  59. gradientname(\1)
  60.  
  61. where gradientname is the name entered in the double quotes.
  62.  
  63. Remember to click the RELOAD FUNCTIONS button
  64. so that it will appear in the functions list
  65. and to test if you did it right.
  66.  
  67. There will be no error messages if you edited this file correctly.
  68. Don't forget to click FINISH then OK when you're done.
  69. If you want to test it, use the QUIRK TEST button so
  70. you don't flood memos or chats.
  71. """
Advertisement
Add Comment
Please, Sign In to add comment