mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-26 03:54:08 +01:00
Strip colour before applying new colour in Filter.rainbow and colorize
This makes them work much better when the input text already contains colour. (cherry picked from commit jacksonmj/Limnoria@be83befabf)
This commit is contained in:
parent
bc19a9fc7f
commit
61f2df5cc3
@ -393,7 +393,12 @@ class Filter(callbacks.Plugin):
|
|||||||
|
|
||||||
Returns <text> with each character randomly colorized.
|
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]
|
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'))
|
irc.reply('%s%s' % (''.join(L), '\x03'))
|
||||||
colorize = wrap(colorize, ['text'])
|
colorize = wrap(colorize, ['text'])
|
||||||
|
|
||||||
@ -405,6 +410,7 @@ class Filter(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
if minisix.PY2:
|
if minisix.PY2:
|
||||||
text = text.decode('utf-8')
|
text = text.decode('utf-8')
|
||||||
|
text = ircutils.stripColor(text)
|
||||||
colors = utils.iter.cycle(['05', '04', '07', '08', '09', '03', '11',
|
colors = utils.iter.cycle(['05', '04', '07', '08', '09', '03', '11',
|
||||||
'10', '12', '02', '06', '13'])
|
'10', '12', '02', '06', '13'])
|
||||||
L = [self._color(c, fg=next(colors)) for c in text]
|
L = [self._color(c, fg=next(colors)) for c in text]
|
||||||
|
Loading…
Reference in New Issue
Block a user