Changed backgrounnd ANSI flag from - to [

This commit is contained in:
Kelketek Rritaa 2014-01-26 08:07:58 -06:00
parent 09ee3c3f2c
commit d69f4dc674
2 changed files with 6 additions and 6 deletions

View file

@ -597,15 +597,15 @@ class CmdColorTest(MuxPlayerCommand):
# foreground table
table[ir].append("{%i%i%i%s{n" % (ir, ig, ib, "{{%i%i%i" % (ir, ig, ib)))
# background table
table[6+ir].append("{-%i%i%i{%i%i%i%s{n" % (ir, ig, ib,
table[6+ir].append("{[%i%i%i{%i%i%i%s{n" % (ir, ig, ib,
5 - ir, 5 - ig, 5 - ib,
"{{-%i%i%i" % (ir, ig, ib)))
"{{[%i%i%i" % (ir, ig, ib)))
table = self.table_format(table)
string = "Xterm256 colors (if not all hues show, your client might not report that it can handle xterm256):"
for row in table:
string += "\n" + "".join(row)
self.msg(string)
self.msg("(e.g. %%c123 and %%cb123 also work)")
self.msg("(e.g. %%123 and %%[123 also work)")
else:
# malformed input
self.msg("Usage: @color ansi|xterm256")

View file

@ -95,7 +95,7 @@ class ANSIParser(object):
return ""
rgbtag = rgbmatch.groups()[0]
background = rgbtag[0] == '-'
background = rgbtag[0] == '['
if background:
red, green, blue = int(rgbtag[1]), int(rgbtag[2]), int(rgbtag[3])
else:
@ -254,9 +254,9 @@ class ANSIParser(object):
xterm256_map = [
(r'%([0-5]{3})', parse_rgb), # %123 - foreground colour
(r'%(-[0-5]{3})', parse_rgb), # %-123 - background colour
(r'%(\[[0-5]{3})', parse_rgb), # %-123 - background colour
(r'{([0-5]{3})', parse_rgb), # {123 - foreground colour
(r'{(-[0-5]{3})', parse_rgb) # {-123 - background colour
(r'{(\[[0-5]{3})', parse_rgb) # {-123 - background colour
]
# obs - order matters here, we want to do the xterms first since