Files
tilde-projects/Code/irc/rainbow.py
T

19 lines
370 B
Python
Raw Normal View History

2016-01-06 14:08:25 -05:00
import random
2018-10-05 16:02:38 -04:00
2016-01-06 14:08:25 -05:00
def makeRainbow(word):
word = word or "RAINBOW"
output = ""
2018-10-05 16:02:38 -04:00
rb = ["5", "7", "8", "3", "12", "13", "6"]
2016-01-06 14:08:25 -05:00
bg = "01"
idx = random.randrange(0, len(rb))
for l in word:
if l == " ":
2018-10-05 16:02:38 -04:00
output += " "
2016-01-06 14:08:25 -05:00
else:
output += "\x03" + rb[idx % len(rb)] + "," + bg + l
idx += 1
return output