3. girc.formatting — Formatting¶
This module handles formatting codes within messages, such as italics, bold, and colour codes.
Formatting codes in girc are prepended with a $ symbol. This is a full table of formatting codes:
| Code | Name | Description |
$b |
Bold | Shows the message as bold |
$i |
Italics | Shows the message as italics (often not implemented) |
$u |
Underline | Shows the message as underlined (often not implemented) |
$c |
Colours | Allows for colour codes |
$r |
Reset | Removes all formatting codes, sets back to standard text |
3.1. Colour Codes¶
Using colour codes, you can specify the foreground and background colours of text.
To use colour codes in girc, you can use the simplified colour syntax, as the examples below:
Test $c[blue]message $c[red]$b*BZZT*$r
Test $c[blue,green]message$r
Valid colour codes:
whiteblackbluegreenredbrownmagentaorangeyellowlight greencyanlight cyanlight bluelight magentagreylight grey
3.2. Escaping and Unescaping¶
There are two standard functions to convert a message to and from the original to an escaped version:
-
formatting.escape(msg)¶ Takes a raw IRC message and returns a girc-escaped message.
-
formatting.unescape(msg, extra_format_dict={})¶ Takes a girc-escaped message and returns a raw IRC message