<pclass="last">You are reading an old version of the Evennia documentation. <ahref="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">Xterm256</span></code> - 128 RGB colors, 32 greyscales. Not always supported in old clients.</p></li>
</ul>
<p>To see which colours your client support, use the default <codeclass="docutils literal notranslate"><spanclass="pre">color</span></code> command. This will list all
available colours for ANSI and Xterm256 along with the codes you use for them. The
central ansi/xterm256 parser is located in <aclass="reference internal"href="../api/evennia.utils.ansi.html#evennia-utils-ansi"><spanclass="std std-ref">evennia/utils/ansi.py</span></a>.</p>
<sectionid="ansi-colours">
<h2>ANSI colours<aclass="headerlink"href="#ansi-colours"title="Permalink to this headline">¶</a></h2>
<p>Evennia supports the <codeclass="docutils literal notranslate"><spanclass="pre">ANSI</span></code> standard for text. This is by far the most supported MUD-color standard, available in all but the most ancient mud clients.</p>
<p>To colour your text you put special tags in it. Evennia will parse these and convert them to the
correct markup for the client used. If the user’s client/console/display supports ANSI colour, they
will see the text in the specified colour, otherwise the tags will be stripped (uncolored text).</p>
<p>For the webclient, Evennia will translate the codes to CSS tags.</p>
<td><p>end all color formatting, including background colors.</p></td>
</tr>
<trclass="row-odd"><td><p>|r</p></td>
<td><p>bright red foreground color</p></td>
</tr>
<trclass="row-even"><td><p>|g</p></td>
<td><p>bright green foreground color</p></td>
</tr>
<trclass="row-odd"><td><p>|y</p></td>
<td><p>bright yellow foreground color</p></td>
</tr>
<trclass="row-even"><td><p>|b</p></td>
<td><p>bright blue foreground color</p></td>
</tr>
<trclass="row-odd"><td><p>|m</p></td>
<td><p>bright magentaforeground color</p></td>
</tr>
<trclass="row-even"><td><p>|c</p></td>
<td><p>bright cyan foreground color</p></td>
</tr>
<trclass="row-odd"><td><p>|w</p></td>
<td><p>bright white foreground color</p></td>
</tr>
<trclass="row-even"><td><p>|x</p></td>
<td><p>bright black (dark grey) foreground color</p></td>
</tr>
<trclass="row-odd"><td><p>|R</p></td>
<td><p>normal red foreground color</p></td>
</tr>
<trclass="row-even"><td><p>|G</p></td>
<td><p>normal green foreground color</p></td>
</tr>
<trclass="row-odd"><td><p>|Y</p></td>
<td><p>normal yellow foreground color</p></td>
</tr>
<trclass="row-even"><td><p>|B</p></td>
<td><p>normal blue foreground color</p></td>
</tr>
<trclass="row-odd"><td><p>|M</p></td>
<td><p>normal magentaforeground color</p></td>
</tr>
<trclass="row-even"><td><p>|C</p></td>
<td><p>normal cyan foreground color</p></td>
</tr>
<trclass="row-odd"><td><p>|W</p></td>
<td><p>normal white (light grey) foreground color</p></td>
</tr>
<trclass="row-even"><td><p>|X</p></td>
<td><p>normal black foreground color</p></td>
</tr>
<trclass="row-odd"><td><p>|[#</p></td>
<td><p>background colours, e.g. |[c for bright cyan background and |[C a normal cyan background.</p></td>
</tr>
<trclass="row-even"><td><p>|!#</p></td>
<td><p>foreground color that inherits brightness from previous tags. Always uppcase, like |!R</p></td>
</tr>
<trclass="row-odd"><td><p>|h</p></td>
<td><p>make any following foreground ANSI colors bright (no effect on Xterm colors). Use with |!#. Technically, |h|G == |g.</p></td>
</tr>
<trclass="row-even"><td><p>|H</p></td>
<td><p>negates the effects of |h, return foreground to normal (no effect on Xterm colors)</p></td>
</tr>
<trclass="row-odd"><td><p>|/</p></td>
<td><p>line break. Use instead of Python \n when adding strings from in-game.</p></td>
</tr>
<trclass="row-even"><td><p>|-</p></td>
<td><p>tab character when adding strings in-game. Can vay per client, so usually better with spaces.</p></td>
</tr>
<trclass="row-odd"><td><p>|_</p></td>
<td><p>a space. Only needed to avoid auto-cropping at the end of a in-game input</p></td>
</tr>
<trclass="row-even"><td><p>|*</p></td>
<td><p>invert the current text/background colours, like a marker. See note below.</p></td>
</tr>
</tbody>
</table>
<p>Here is an example of the tags in action:</p>
<divclass="highlight-none notranslate"><divclass="highlight"><pre><span></span> |rThis text is bright red.|n This is normal text.
|RThis is a dark red text.|n This is normal text.
|[rThis text has red background.|n This is normal text.
|b|[yThis is bright blue text on yellow background.|n This is normal text.
</pre></div>
</div>
<p>Note: The ANSI standard does not actually support bright backgrounds like <codeclass="docutils literal notranslate"><spanclass="pre">|[r</span></code> - the standard
only supports “normal” intensity backgrounds. To get around this Evennia implements these as <aclass="reference internal"href="#xterm256-colours"><spanclass="std std-doc">Xterm256 colours</span></a> behind the scenes. If the client does not support
Xterm256 the ANSI colors will be used instead and there will be no visible difference between using upper- and lower-case background tags.</p>
<p>If you want to display an ANSI marker as output text (without having any effect), you need to escape it by preceding its <codeclass="docutils literal notranslate"><spanclass="pre">|</span></code> with another <codeclass="docutils literal notranslate"><spanclass="pre">|</span></code>:</p>
<p>This will output the raw <codeclass="docutils literal notranslate"><spanclass="pre">|r</span></code> without any color change. This can also be necessary if you are doing
ansi art that uses <codeclass="docutils literal notranslate"><spanclass="pre">|</span></code> with a letter directly following it.</p>
<p>to get a list of all supported ANSI colours and the tags used to produce them.</p>
<p>A few additional ANSI codes are supported:</p>
<sectionid="caveats-of">
<h3>Caveats of <codeclass="docutils literal notranslate"><spanclass="pre">|*</span></code><aclass="headerlink"href="#caveats-of"title="Permalink to this headline">¶</a></h3>
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">|*</span></code> tag (inverse video) is an old ANSI standard and should usually not be used for more than to
mark short snippets of text. If combined with other tags it comes with a series of potentially
confusing behaviors:</p>
<ul>
<li><p>The <codeclass="docutils literal notranslate"><spanclass="pre">|*</span></code> tag will only work once in a row:, ie: after using it once it won’t have an effect again
until you declare another tag. This is an example:</p>
<p>that is, it will not reverse to normal at the second <codeclass="docutils literal notranslate"><spanclass="pre">|*</span></code>. You need to reset it manually:</p>
<p>So <codeclass="docutils literal notranslate"><spanclass="pre">|*</span></code> only considers the ‘true’ foreground color, ignoring any highlighting. Think of the bright
state (<codeclass="docutils literal notranslate"><spanclass="pre">|h</span></code>) as something like like <codeclass="docutils literal notranslate"><spanclass="pre"><strong></span></code> in HTML: it modifies the <em>appearance</em> of a normal
foreground color to match its bright counterpart, without changing its normal color.</p>
<ul>
<li><p>Finally, after a <codeclass="docutils literal notranslate"><spanclass="pre">|*</span></code>, if the previous background was set to a dark color (via <codeclass="docutils literal notranslate"><spanclass="pre">|[</span></code>), <codeclass="docutils literal notranslate"><spanclass="pre">|!#</span></code>) will
actually change the background color instead of the foreground:</p>
<divclass="highlight-default notranslate"><divclass="highlight"><pre><span></span>|*reversed text |!R now BG is red.
</pre></div>
</div>
</li>
</ul>
<p>For a detailed explanation of these caveats, see the [Understanding Color Tags](Understanding-Color-
Tags) tutorial. But most of the time you might be better off to simply avoid <codeclass="docutils literal notranslate"><spanclass="pre">|*</span></code> and mark your text
manually instead.</p>
</section>
</section>
<sectionid="xterm256-colours">
<h2>Xterm256 Colours<aclass="headerlink"href="#xterm256-colours"title="Permalink to this headline">¶</a></h2>
<asideclass="sidebar">
<p>See the <aclass="reference internal"href="../Howtos/Tutorial-Understanding-Color-Tags.html"><spanclass="doc std std-doc">Understanding Color Tags</span></a> tutorial, for more on the use of ANSI color tags and the pitfalls of mixing ANSI and Xterms256 color tags in the same context.</p>
</aside>
<p>The <em>Xterm256</em> standard is a colour scheme that supports 256 colours for text and/or background. It can be combined freely with ANSI colors (above), but some ANSI tags don’t affect Xterm256 tags.</p>
<p>While this offers many more possibilities than traditional ANSI colours, be wary that too many text
colors will be confusing to the eye. Also, not all clients support Xterm256 - these will instead see
the closest equivalent ANSI color. You can mix Xterm256 tags with ANSI tags as you please.</p>
<td><p>foreground RGB (red/green/blue), each from 0 to 5.</p></td>
</tr>
<trclass="row-odd"><td><p>|[###</p></td>
<td><p>background RGB</p></td>
</tr>
<trclass="row-even"><td><p>|=#</p></td>
<td><p>a-z foreground greyscale, where <codeclass="docutils literal notranslate"><spanclass="pre">a</span></code> is black and <codeclass="docutils literal notranslate"><spanclass="pre">z</span></code> is white.</p></td>
<p>to get a table of all the 256 colours and the codes that produce them. If the table looks broken up
into a few blocks of colors, it means Xterm256 is not supported and ANSI are used as a replacement. You can use the <codeclass="docutils literal notranslate"><spanclass="pre">options</span></code> command to see if xterm256 is active for you. This depends on if your client told Evennia what it supports - if not, and you know what your client supports, you may have to activate some features manually.</p>
<pclass="last">You are reading an old version of the Evennia documentation. <ahref="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.