Merge pull request #1194 from GLolol/filter/rainbow-stripcolor

Strip colour before applying new colour in Filter.rainbow and colorize
This commit is contained in:
Valentin Lorentz 2015-12-02 09:41:56 +01:00
commit 1493adc041

View File

@ -393,7 +393,12 @@ class Filter(callbacks.Plugin):
Returns <text> with each character randomly colorized.
"""
if minisix.PY2:
text = text.decode('utf-8')
text = ircutils.stripColor(text)
L = [self._color(c) for c in text]
if minisix.PY2:
L = [c.encode('utf-8') for c in L]
irc.reply('%s%s' % (''.join(L), '\x03'))
colorize = wrap(colorize, ['text'])
@ -405,6 +410,7 @@ class Filter(callbacks.Plugin):
"""
if minisix.PY2:
text = text.decode('utf-8')
text = ircutils.stripColor(text)
colors = utils.iter.cycle(['05', '04', '07', '08', '09', '03', '11',
'10', '12', '02', '06', '13'])
L = [self._color(c, fg=next(colors)) for c in text]