Add warning about using {-color contrib syntax

This commit is contained in:
Griatch 2022-10-29 18:32:09 +02:00
parent 6a0df97c16
commit 3692750637

View file

@ -95,6 +95,65 @@ _ANSI_TAB = "\t"
_ANSI_SPACE = " "
#############################################################
#
# %c - MUX/MUSH style markup. This was Evennia's first
# color markup style. It was phased out due to % being used
# in Python formatting operations.
#
# %ch%cr, %cr - bright/dark red foreground
# %ch%cR, %cR- bright/dark red background
# %c500, %c[500 - XTERM256 red foreground/background
# %c=w, %c[=w - XTERM256 greyscale foreground/background
#
#############################################################
MUX_COLOR_ANSI_EXTRA_MAP = [
(r"%cn", _ANSI_NORMAL), # reset
(r"%ch", _ANSI_HILITE), # highlight
(r"%r", _ANSI_RETURN), # line break
(r"%R", _ANSI_RETURN), #
(r"%t", _ANSI_TAB), # tab
(r"%T", _ANSI_TAB), #
(r"%b", _ANSI_SPACE), # space
(r"%B", _ANSI_SPACE),
(r"%cf", _ANSI_BLINK), # annoying and not supported by all clients
(r"%ci", _ANSI_INVERSE), # invert
(r"%cr", _ANSI_RED),
(r"%cg", _ANSI_GREEN),
(r"%cy", _ANSI_YELLOW),
(r"%cb", _ANSI_BLUE),
(r"%cm", _ANSI_MAGENTA),
(r"%cc", _ANSI_CYAN),
(r"%cw", _ANSI_WHITE),
(r"%cx", _ANSI_BLACK),
(r"%cR", _ANSI_BACK_RED),
(r"%cG", _ANSI_BACK_GREEN),
(r"%cY", _ANSI_BACK_YELLOW),
(r"%cB", _ANSI_BACK_BLUE),
(r"%cM", _ANSI_BACK_MAGENTA),
(r"%cC", _ANSI_BACK_CYAN),
(r"%cW", _ANSI_BACK_WHITE),
(r"%cX", _ANSI_BACK_BLACK),
]
MUX_COLOR_XTERM256_EXTRA_FG = [r"%c([0-5])([0-5])([0-5])"] # %c123 - foreground colour
MUX_COLOR_XTERM256_EXTRA_BG = [r"%c\[([0-5])([0-5])([0-5])"] # %c[123 - background colour
MUX_COLOR_XTERM256_EXTRA_GFG = [r"%c=([a-z])"] # %c=a - greyscale foreground
MUX_COLOR_XTERM256_EXTRA_GBG = [r"%c\[=([a-z])"] # %c[=a - greyscale background
MUX_COLOR_ANSI_XTERM256_BRIGHT_BG_EXTRA_MAP = [
(r"%ch%cR", r"%c[500"),
(r"%ch%cG", r"%c[050"),
(r"%ch%cY", r"%c[550"),
(r"%ch%cB", r"%c[005"),
(r"%ch%cM", r"%c[505"),
(r"%ch%cC", r"%c[055"),
(r"%ch%cW", r"%c[555"), # white background
(r"%ch%cX", r"%c[222"), # dark grey background
]
#############################################################
#
# {- style MUD markup (old Evennia default). This is
@ -102,6 +161,12 @@ _ANSI_SPACE = " "
# a curly bracket instead. This was removed because {}
# are used in Python string formatting.
#
# WARNING - using this will lead to errors in systems using
# {} mapping (like Object.msg_contents). This is a known error
# that will not be addressed. It's the reason this is no
# longer the default. Use this at your own peril and expect
# to have to fix things yourself.
#
# {r, {R - bright/dark red foreground
# {[r, {[R - bright/dark red background
# {500, {[500 - XTERM256 red foreground/background
@ -170,62 +235,3 @@ CURLY_COLOR_ANSI_XTERM256_BRIGHT_BG_EXTRA_MAP = [
(r"{[w", r"{[555"), # white background
(r"{[x", r"{[222"), # dark grey background
]
#############################################################
#
# %c - MUX/MUSH style markup. This was Evennia's first
# color markup style. It was phased out due to % being used
# in Python formatting operations.
#
# %ch%cr, %cr - bright/dark red foreground
# %ch%cR, %cR- bright/dark red background
# %c500, %c[500 - XTERM256 red foreground/background
# %c=w, %c[=w - XTERM256 greyscale foreground/background
#
#############################################################
MUX_COLOR_ANSI_EXTRA_MAP = [
(r"%cn", _ANSI_NORMAL), # reset
(r"%ch", _ANSI_HILITE), # highlight
(r"%r", _ANSI_RETURN), # line break
(r"%R", _ANSI_RETURN), #
(r"%t", _ANSI_TAB), # tab
(r"%T", _ANSI_TAB), #
(r"%b", _ANSI_SPACE), # space
(r"%B", _ANSI_SPACE),
(r"%cf", _ANSI_BLINK), # annoying and not supported by all clients
(r"%ci", _ANSI_INVERSE), # invert
(r"%cr", _ANSI_RED),
(r"%cg", _ANSI_GREEN),
(r"%cy", _ANSI_YELLOW),
(r"%cb", _ANSI_BLUE),
(r"%cm", _ANSI_MAGENTA),
(r"%cc", _ANSI_CYAN),
(r"%cw", _ANSI_WHITE),
(r"%cx", _ANSI_BLACK),
(r"%cR", _ANSI_BACK_RED),
(r"%cG", _ANSI_BACK_GREEN),
(r"%cY", _ANSI_BACK_YELLOW),
(r"%cB", _ANSI_BACK_BLUE),
(r"%cM", _ANSI_BACK_MAGENTA),
(r"%cC", _ANSI_BACK_CYAN),
(r"%cW", _ANSI_BACK_WHITE),
(r"%cX", _ANSI_BACK_BLACK),
]
MUX_COLOR_XTERM256_EXTRA_FG = [r"%c([0-5])([0-5])([0-5])"] # %c123 - foreground colour
MUX_COLOR_XTERM256_EXTRA_BG = [r"%c\[([0-5])([0-5])([0-5])"] # %c[123 - background colour
MUX_COLOR_XTERM256_EXTRA_GFG = [r"%c=([a-z])"] # %c=a - greyscale foreground
MUX_COLOR_XTERM256_EXTRA_GBG = [r"%c\[=([a-z])"] # %c[=a - greyscale background
MUX_COLOR_ANSI_XTERM256_BRIGHT_BG_EXTRA_MAP = [
(r"%ch%cR", r"%c[500"),
(r"%ch%cG", r"%c[050"),
(r"%ch%cY", r"%c[550"),
(r"%ch%cB", r"%c[005"),
(r"%ch%cM", r"%c[505"),
(r"%ch%cC", r"%c[055"),
(r"%ch%cW", r"%c[555"), # white background
(r"%ch%cX", r"%c[222"), # dark grey background
]