diff options
Diffstat (limited to 'plugins/rainbow.py')
-rw-r--r-- | plugins/rainbow.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/rainbow.py b/plugins/rainbow.py index bb9ab8a3..4ab0b9ac 100644 --- a/plugins/rainbow.py +++ b/plugins/rainbow.py @@ -22,11 +22,15 @@ import random possible_colors = list(range(256)) # remove the colors that are almost white or almost black -for col in [16, 232, 233, 234, 235, 236, 237, 15, 231, 255, 254, 253, 252, 251]: +for col in [ + 16, 232, 233, 234, 235, 236, 237, 15, 231, 255, 254, 253, 252, 251 +]: possible_colors.remove(col) + def rand_color(): - return '\x19%s}' % (random.choice(possible_colors),) + return '\x19%s}' % (random.choice(possible_colors), ) + class Plugin(BasePlugin): def init(self): @@ -35,4 +39,9 @@ class Plugin(BasePlugin): self.api.add_event_handler('conversation_say', self.rainbowize) def rainbowize(self, msg, tab): - msg['body'] = ''.join(['%s%s' % (rand_color(),char,) for char in xhtml.clean_text(msg['body'])]) + msg['body'] = ''.join([ + '%s%s' % ( + rand_color(), + char, + ) for char in xhtml.clean_text(msg['body']) + ]) |