From WikiChip
$color Identifier - mIRC
< mirc‎ | identifiers

The $color identifier allows mIRC to return the color index number associated with the specified target/event, or return the RGB color for a color index number. $colour is an identical functioning identifier for those who find comfort using a 'u' to spell color.

Synopsis[edit]

$color(name/N)[.dd]

Parameters[edit]

  • name Returns the color index number for the specified name/action/event. Partial matches work as well: $color(action)
  • N Returns the 24-bit integer RGB color value for index N where N is 0-99, of which 0-98 are displayed in the CTRL+K list and the ALT+K window.

Properties[edit]

  • .dd When used with name, allows the color index numbers 0-9 to be returned in double-digit format, eg: 02 instead of 2. Does not work on RGB-returned values.

Names[edit]

Most of the names are shown in the Alt+K dialog, and some of them use spaces due to similar name for the background color in that area. The names accepted by $color are the same names used by echo's -c switch. The names for the background colors are not shown:

//echo -a $color(background)
//echo -a $color(listbox)
//echo -a $color(treebar)
//echo -a $color(editbox)

The only names requiring 'text' are those where the absence of 'text' would be the same name as any of the above four:

//echo -a $color(listbox text)
//echo -a $color(treebar text)
//echo -a $color(editbox text)

These names do not require quotes when used as the $color parameter, but do require quotes when used with echo's -c switch:

/echo -ac "listbox text" test

Examples[edit]

Echo the color index number for action events:

//echo -a $color(action)

If Index 0-9 are used for that event, displays a single number unless the .dd property is used:

//echo -a $color(action).dd

Echo the RGB code for index 4:

//echo -a $color(4)
//echo $color(ctcp) $chan this color changes when ctcp event color changes. it does not put color code into logfile
//echo $chan $chr(3) $+ $color(ctcp) this color does not change when ctcp event color changes. it does put color code into logfile

Using .dd prevents numeric first character of string being considered part of the color code, in the event the event's color index is 0-9.

//var %string 123 | echo -a $chr(3) $+ $color(ctcp).dd $+ %string
vs
//var %string 123 | echo -a $chr(3) $+ $color(ctcp)   $+ %string

mIRC blocks the effect of $color if it matches the color used by the background for that text, except when used in the format ^Kn,n which sets the background along with the foreground. In attempting to avoid matching the background color, echo first tries $color(normal) to find a different color index then $color(gray). Invalid 'name' strings return 0.

Compatibility[edit]

Added: mIRC v5.9
Added on: 26 Apr 2001
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also[edit]