mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 12:56:30 +01:00
Fix color ansi output, it listed the wrong indices of colors. Also updated docs. Resolve #3616
This commit is contained in:
parent
cd86f93a54
commit
cce90a0ecd
3 changed files with 39 additions and 38 deletions
|
|
@ -38,6 +38,7 @@ did not add it to the handler's object (Griatch)
|
|||
- [Fix][issue3615]: Using `print()` in `py` caused an infinite loop (Griatch)
|
||||
- [Fix][issue3620]: Better handle TaskHandler running against an attribute that
|
||||
was removed since last reload (Griatch)
|
||||
- [Fix][issue3616]: The `color ansi` command output was broken (Griatch)
|
||||
- [Docs][issue3591]: Fix of NPC reaction tutorial code (Griatch)
|
||||
- Docs: Tutorial fixes (Griatch, aMiss-aWry, feyrkh)
|
||||
|
||||
|
|
@ -49,6 +50,7 @@ did not add it to the handler's object (Griatch)
|
|||
[issue3624]: https://github.com/evennia/evennia/issues/3624
|
||||
[issue3615]: https://github.com/evennia/evennia/issues/3615
|
||||
[issue3620]: https://github.com/evennia/evennia/issues/3620
|
||||
[issue3616]: https://github.com/evennia/evennia/issues/3616
|
||||
[pull3595]: https://github.com/evennia/evennia/pull/3595
|
||||
[pull3533]: https://github.com/evennia/evennia/pull/3533
|
||||
[pull3594]: https://github.com/evennia/evennia/pull/3594
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ To see which colours your client support, use the default `color` command. This
|
|||
available colours for ANSI and Xterm256 along with the codes you use for them. The
|
||||
central ansi/xterm256 parser is located in [evennia/utils/ansi.py](evennia.utils.ansi).
|
||||
|
||||
## ANSI colours
|
||||
## ANSI colours and symbols
|
||||
|
||||
Evennia supports the `ANSI` standard for text. This is by far the most supported MUD-color standard, available in all but the most ancient mud clients.
|
||||
|
||||
|
|
@ -35,39 +35,39 @@ will see the text in the specified colour, otherwise the tags will be stripped (
|
|||
|
||||
For the webclient, Evennia will translate the codes to CSS tags.
|
||||
|
||||
| Tag | Effect |
|
||||
| ---- | ----- |
|
||||
| \|n | end all color formatting, including background colors. |
|
||||
|\|r | bright red foreground color |
|
||||
|\|g | bright green foreground color |
|
||||
|\|y | bright yellow foreground color |
|
||||
|\|b | bright blue foreground color |
|
||||
|\|m | bright magentaforeground color |
|
||||
|\|c | bright cyan foreground color |
|
||||
|\|w | bright white foreground color |
|
||||
|\|x | bright black (dark grey) foreground color |
|
||||
|\|R | normal red foreground color |
|
||||
|\|G | normal green foreground color |
|
||||
|\|Y | normal yellow foreground color |
|
||||
|\|B | normal blue foreground color |
|
||||
|\|M | normal magentaforeground color |
|
||||
|\|C | normal cyan foreground color |
|
||||
|\|W | normal white (light grey) foreground color |
|
||||
|\|X | normal black foreground color |
|
||||
| \|\[# | background colours, e.g. \|\[c for bright cyan background and \|\[C a normal cyan background. |
|
||||
| \|!# | foreground color that inherits brightness from previous tags. Always uppcase, like \|!R |
|
||||
| \|h | make any following foreground ANSI colors bright (for Xterm256/true color makes the font bold if client supports it). Use with \|!#. Technically, \|h\|G == \|g. |
|
||||
| \|H | negates the effects of \|h |
|
||||
| \|u | underline font if client supports it |
|
||||
| \|U | negates the effects of \|u |
|
||||
| \|i | italic font if client supports it |
|
||||
| \|I | negates the effects of \|i |
|
||||
| \|s | strikethrough font if client supports it |
|
||||
| \|S | negates the effects of \|s |
|
||||
| \|/ | line break. Use instead of Python \\n when adding strings from in-game. |
|
||||
| \|- | tab character when adding strings in-game. Can vay per client, so usually better with spaces. |
|
||||
| \|_ | a space. Only needed to avoid auto-cropping at the end of a in-game input |
|
||||
| \|* | invert the current text/background colours, like a marker. See note below. |
|
||||
| Tag | Effect | |
|
||||
| ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|
||||
| \|n | end all color formatting, including background colors. | |
|
||||
| \|r | bright red foreground color | |
|
||||
| \|g | bright green foreground color | |
|
||||
| \|y | bright yellow foreground color | |
|
||||
| \|b | bright blue foreground color | |
|
||||
| \|m | bright magentaforeground color | |
|
||||
| \|c | bright cyan foreground color | |
|
||||
| \|w | bright white foreground color | |
|
||||
| \|x | bright black (dark grey) foreground color | |
|
||||
| \|R | normal red foreground color | |
|
||||
| \|G | normal green foreground color | |
|
||||
| \|Y | normal yellow foreground color | |
|
||||
| \|B | normal blue foreground color | |
|
||||
| \|M | normal magentaforeground color | |
|
||||
| \|C | normal cyan foreground color | |
|
||||
| \|W | normal white (light grey) foreground color | |
|
||||
| \|X | normal black foreground color | |
|
||||
| \|\[# | background colours, e.g. \|\[c for bright cyan background and \|\[C a normal cyan background. | |
|
||||
| \|!# | foreground color that inherits brightness from previous tags. Always uppcase, like \|!R | |
|
||||
| \|h | make any following foreground ANSI colors bright (for Xterm256/true color makes the font bold if client supports it). Use with \|!#. Technically, \|h\|G == \|g. | |
|
||||
| \|H | negates the effects of \|h | |
|
||||
| \|u | underline font (not supported in Evennia webclient) | |
|
||||
| \|U | negates the effects of \|u | |
|
||||
| \|i | italic font (not supported in Evennia webclient) | |
|
||||
| \|I | negates the effects of \|i | |
|
||||
| \|s | strikethrough font (not supported in Evennia webclient) | |
|
||||
| \|S | negates the effects of \|s | |
|
||||
| \|/ | line break. Use instead of Python \\n when adding strings from in-game. | |
|
||||
| \|- | tab character when adding strings in-game. Can vay per client, so usually better with spaces. | |
|
||||
| \|_ | a space. Only needed to avoid auto-cropping at the end of a in-game input | |
|
||||
| \|* | invert the current text/background colours, like a marker. See note below. | |
|
||||
|
||||
Here is an example of the tags in action:
|
||||
|
||||
|
|
|
|||
|
|
@ -22,9 +22,8 @@ method. Otherwise all text will be returned to all connected sessions.
|
|||
import time
|
||||
from codecs import lookup as codecs_lookup
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
import evennia
|
||||
from django.conf import settings
|
||||
from evennia.utils import create, logger, search, utils
|
||||
|
||||
COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS)
|
||||
|
|
@ -814,8 +813,8 @@ class CmdColorTest(COMMAND_DEFAULT_CLASS):
|
|||
# the slices of the ANSI_PARSER lists to use for retrieving the
|
||||
# relevant color tags to display. Replace if using another schema.
|
||||
# This command can only show one set of markup.
|
||||
slice_bright_fg = slice(7, 15) # from ANSI_PARSER.ansi_map
|
||||
slice_dark_fg = slice(15, 23) # from ANSI_PARSER.ansi_map
|
||||
slice_bright_fg = slice(13, 21) # from ANSI_PARSER.ansi_map
|
||||
slice_dark_fg = slice(21, 29) # from ANSI_PARSER.ansi_map
|
||||
slice_dark_bg = slice(-8, None) # from ANSI_PARSER.ansi_map
|
||||
slice_bright_bg = slice(None, None) # from ANSI_PARSER.ansi_xterm256_bright_bg_map
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue