ailin-nemui edited this page Mar 31, 2017 · 43 revisions


Primary source of content from docs/formats.

home |


Local Colours

In the following table, C1 indicates the bright or bold version of a character, dependng on your terminal configuration. C2 produces the standard (dull/dark) characters of the specified colour, whilst C3 manipulates the background colour.

After the initial table, there are a list of special formatting codes such as %_ and %*. These behave in exactly the same way as the other colour formatting codes.

Once a code is inserted into a printable string, its attributes will be applied to the string until the next code. %n and %N are useful in this matter for resorting the original colour/format of the text in question. %n reverts to the previous code, whilst %N switches to the terminal default, which is configured in theme/Misc.

Irssi's colors that you can use in text formats, hilights, etc:

C1      C2      C3       Text Colour (C1) Text Colour (C2) Background (C3)
%k      %K       %0      black            dark grey        black
%r      %R       %1      red              bright red       red
%g      %G       %2      green            bright green     green
%y      %Y       %3      yellow           bright yellow    yellow
%b      %B       %4      blue             bright blue      blue
%m      %M       %5      magenta          bright magenta   magenta
%p      %P               magenta (think: purple)
%c      %C       %6      cyan             bright cyan      cyan
%w      %W       %7      light grey       white            light grey

%XAB            %xAB     Color from extended plane (A=1-7, B=0-Z)
%ZAABBCC    %zAABBCC     HTML color (in hex notation)

%n      %N               Changes the color to "default color", removing
                         all other coloring and formatting. %N is always
                         the terminal's default color. %n is usually too,
                         except in themes it changes to "previous color",
                         ie. hello = "%Rhello%n" and "%G{hello} world"
                         would print hello in red, and %n would turn back
                         into %G making world green.

%F                       Blinking on/off (think: flash)
%U                       Underline on/off
%I                       Italic on/off
%8                       Reverse on/off
%9      %_               Bold on/off
%:                       Insert newline
%|                       Marks the indentation position
%#                       Monospace font on/off (useful with lists and GUI)
%%                       A single %

Some terminals do no support all of these attributes, and it may necessary to troubleshoot your terminal for those kinds of problems before blaming irssi.

The 256 colour codes can be viewed with the /CUBES command from within irssi.

These colours can be used within formats and theme abstracts, or they can be used in scripts.

Colourising Text in IRC Messages

It is possible to send messages to both individual users and channels which contain a different style of embedded colour codes.

They originated with mIRC, but have long been considered a de-facto standard. They can be produced interactively with the following key-combinations (assuming the keys have not been bound to some other function)

In the list below, '#' means a number as MIRC color code):

\x{02}    <Ctrl>-b        set bold
\x{03}    <Ctrl>-c #[,#]  set foreground and optionally background color.
                There is no space between the C-c and number(s).
\x{  }    <Ctrl>-o        reset all formats to plain text
\x{  }    <Ctrl>-v        set inverted color mode
\x{  }    <Ctrl>-_        set underline
\x{  }    <Ctrl>-7        same as <Ctrl>-_

To reset a mode set it again:


creates black on green FOO followed by a green on black BAR

foreground (fg)     background (bg)
   0          white               light gray   + blinking fg
   1          black               black
   2          blue                blue
   3          green               green
   4          light red           red          + blinking fg
   5          red                 red
   6          magenta (purple)    magenta
   7          orange              orange
   8          yellow              orange       + blinking fg
   9          light green         green        + blinking fg
   10         cyan                cyan
   11         light cyan          cyan         + blinking fg
   12         light blue          blue         + blinking fg
   13         light magenta       magenta      + blinking fg
   14         gray                black        + blinking fg
   15         light gray          light gray

These colors may differ depending on how your terminal is configured. In particular the meaning for background may be the same as for the foreground (bright colors, no blinking), and orange often looks like brown or dark yellow.

Note: Some IRC channels consider overusing (or even just using) colours irritating, and you may find yourself kicked for using them. It is also possible, on certain IRC servers, to set a channel mode which prevents colours from appearing; the server filters out the codes before sending your message to the other users.

Finally, you can achieve the same effects from within Perl scripting code using something along the lines of:

Irssi::active_win->command("say \x{03}3Meep!");

The \x{..} is used to insert the special characters such as Ctrl-C. See the key-codes list above for which characters to print in place of the control-characters.

Irssi also accepts the mIRC style formatting codes in certain local display circumstances.

TODO: list where they do / don't work.


Irssi supports variable expansion in a number of places, including within formats and templates. The expansion operates are somewhat limited, but are listed below.

Modifier          Description
$variable         A normal variable, expanding to the first match of:
                  |  1) an internal SET variable
                  |  2) an environment variable
$[num]variable    Expands to the variables value, with 'num' width.  If
                  | the number is negative, the value is right-aligned.
                  | The value is padded to meet the width with the
                  | character given after number (default is space).
                  | The value is truncated to specified width unless
                  | '!' character precedes the number. If '.' character
                  | precedes the number the value isn't padded, just
                  | truncated.
$#variable        Expands to the number of words in $variable. If $variable
                  | is omitted, it assumes $*
$@variable        Expands to the number of characters in $variable. if
                  | $variable is omitted, it assumes $*
$($subvariable)   This is somewhat similar to a pointer, in that the
                  | value of $subvar is taken as the name of the
                  | variable to expand to.  Nesting is allowed.
${expression}     Permits the value to be embedded in another string
                  | unambiguously.
$!history!        Expands to a matching entry in the client's command
                  | history, wildcards allowed.

Some Examples

> /set ctcp_version_reply
< ctcp_version_reply = irssi v$J - running on $sysname $sysarch

> /eval echo $ctcp_version_reply
< Irssi v$J - running on $sysname $sysarch

# double eval expands the internal variables.
> /eval /eval echo $ctcp_version_reply
< Irssi v0.8.15-svn - running on Darwin i386

TODO: provide some examples of the various forms of truncation/padding, etc


Whenever an alias is called, these expandos are set to the arguments passed to it. If none of these expandos are used in the alias, or the $() form shown above, any arguments passed will automatically be appended to the last command in the alias.

Expando   Description
$*        expands to all arguments passed to an alias
$n        expands to argument 'n' passed to an alias (counting from zero)
$n-m      expands to arguments 'n' through 'm' passed to an alias
$n-       expands to all arguments from 'n' on passed to an alias
$-m       expands to all arguments up to 'm' passed to an alias
$~        expands to the last argument passed to an alias


These variables are set and updated dynamically by the client. The case of $A .. $Z is important.

Variable   Description
$,         last person who sent you a MSG
$.         last person to whom you sent a MSG
$:         last person to join a channel you are on
$;         last person to send a public message to a channel you are on
$A         text of your AWAY message, if any
$B         body of last MSG you sent
$C         current channel
$D         last person that NOTIFY detected a signon for
$E         idle time
$F         time client was started, $time() format
$H         current server numeric being processed
$I         channel you were last INVITEd to
$J         client version text string
$K         current value of CMDCHARS
$k         first character in CMDCHARS
$L         current contents of the input line
$M         modes of current channel, if any
$N         current nickname
$O         value of STATUS_OPER if you are an irc operator
$P         if you are a channel operator in $C, expands to a '@'
$Q         nickname of whomever you are QUERYing
$R         version of current server
$S         current server name
$T         target of current input (channel or nick of query)
$U         value of cutbuffer
$V         client release date (format YYYYMMDD)
$W         current working directory
$X         your /userhost $N address (user@host)
$Y         value of REALNAME
$Z         time of day (hh:mm, can be changed with /SET timestamp_format)
$$         a literal '$'

$versiontime         prints time of the irssi version in HHMM format
$sysname             system name (eg. Linux)
$sysrelease          system release (eg. 2.2.18)
$sysarch             system architecture (eg. i686)
$topic               channel topic
$usermode            user mode
$cumode              own channel user mode
$cumode_space        like $cumode, but gives space if there's no mode.
$tag                 server tag
$chatnet             chat network of server
$winref              window reference number
$winname             window name
$itemname            like $T, but use item's visible_name which may be
                     different (eg. $T = !12345chan, $itemname = !chan)
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.