IRC Colors (or mIRC Colors) is a light-weight sub-protocol designed to add support for various text formatting to IRC. The protocol usually supports foreground, background, bold, italics, underline, and reverse.
Text formatting is done via a set of special character sequences that are parsed by the IRC client. Every new segment of text formats starts with one of the formatting control character. The same control character can be used at the end of the format in order to terminate it. The caret notation is used to represent such characters. For example, the ^B character is used to specify bold text.
^BHello World^B will display on supported IRC client as
While originally designed to be exclusively client-side, over time servers have been updated to be made aware of color codes. Some servers support various channel modes to block colors, strip colors, and ban various patterns. The exact level of support depends on the server software used.
Most clients support at least bold and underline. Below are the common shortcuts for those characters:
|Bold||0x02||Ctrl+B / ⌘ Cmd+B|| |
|Italics||0x1D||Ctrl+I / ⌥ Opt+⌘ Cmd+I|| |
|Underline||0x1F||Ctrl+U / ⌥ Opt+⌘ Cmd+U|| |
|Reverse||0x16||Ctrl+R / ⌥ Opt+⌘ Cmd+R|| |
|Plain||0x0F||Ctrl+O / ⌥ Opt+⌘ Cmd+O|| |
The plain text character is used to restore all formatting back to default.
The sub-protocol supports both background and foreground coloring via the
0x03 code point. On most IRC clients, the character can be generated via the Ctrl+K shortcut key ((Ctrl+C) in irssi). The syntax for coloring text is
^CN in irssi) for just foreground color or
^CN,M in irssi) for a background color as well. Where N and M represent any integer between 0 and 15 inclusively, allowing up to sixteen colors.
^K alone can be used to terminate the previous sequence of colored text.
While most client allow the user to change the meaning of those values, the default values are:
Any new sequence of colors will override the previous (or default). If the ^K character is used without any numbers, it will reset the text format back to default. If a color sequence defines a background color and a new color sequence starts without a background color, the previous background color will be used. For example
^K0,1Hello ^4There! will generate the
Using the ^K character as a color terminator will not terminate any other kind of formatting such as bold. For example
^B^K0,1Hello ^KThere! will generate
Hello There! where the bold continues on to the rest of the line. Using the ^O key, however, will restore all formats to default from that point onward.