From df5aeaf9d03f38b97e5bb3dd01aff73cf7b817c3 Mon Sep 17 00:00:00 2001 From: Sfan5 Date: Sat, 4 Jan 2014 16:19:19 +0100 Subject: [PATCH] Make the rainbow amazing! <3 --- rainbow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rainbow.py b/rainbow.py index 4fa3310..9b063f9 100755 --- a/rainbow.py +++ b/rainbow.py @@ -11,11 +11,15 @@ rainbowcolors = ["4", "7", "8", "3", "12", "6", "13"] def colorize(text): out = "" i = 0 + j = 0 for c in text: if c in list(str(i) for i in range(10)): c = u"\u200b" + c # 'ZERO WIDTH SPACE' cuz IRC clients are stupid out += "\x03" + str(rainbowcolors[i]) + c - i += 1 + j += 1 + if j >= 3: + i += 1 + j = 0 if i >= len(rainbowcolors): i = 0 return out