Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.
Liam Stanley edited this page Feb 2, 2015 · 1 revision

IRC color code formatting

Most IRC clients will accept Caret Notation for formatting IRC text.

Colors

A new method has been created, to where, when defining a string you can simply use:

mystring = '{color}{formattype}stuff here'

# For example...
mystring = '{bold}{red}Ohh no! I got an error!'

Code will automatically parse and replace those variables in the string upon sending the string to things like code.say(), code.msg(), code.reply(), code.notice(), but will NOT replace those variables if you use write() or _write().

Due to using {variable} in strings to make colors, this can cause an issue with the normal str.format() built into Python. If you use str.format() on a string that includes color formatting (using the method above..), call code.format(str_with_colors).format(your stuff here) to make it change those variables before it actually calls str.format()

Old method: The general formula for colors are ^CN,M. ^C is \x03, N will be the text (foreground) color, M a background color. A background color is not always included. If no background color is set the receiving client uses a default background color (white). Additionally you can use color 99 to indicate a transparent color.

color codes

00 white, 01 black, 02 blue (navy), 03 green, 04 red, 05 brown (maroon), 06 purple, 07 orange (olive), 08 yellow, 09 light green (lime), 10 teal (a green/blue cyan), 11 light cyan (cyan) (aqua), 12 light blue (royal), 13 pink (light purple) (fuchsia), 14 grey, 15 light grey (silver)

Example: Red writing blue background would be code.reply("\x030402Example\x03")

Clone this wiki locally