From WikiChip
Difference between revisions of "mirc/identifiers/$color"
< mirc‎ | identifiers

m (Bot: Adding a template (template:mIRC identifier list))
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The '''$color''' identifier allows mIRC to return the proper color code associated with the specified target.
+
{{mirc title|$color Identifier}}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 ==
 
== Synopsis ==
<pre>$color(name/N)[.property]</pre>
+
<pre>$color(name/N)[.dd]</pre>
 
 
 
== Parameters ==
 
== Parameters ==
{{ArgsList
+
* '''name''' Returns the color index number for the specified name/action/event. Partial matches work as well: '''$color(action)'''
| name | Returns the color code 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-15 are displayed in the '''CTRL+K''' list and the '''ALT+K''' window.
| N | Specifies that the color code to be looked up is the RGB value for a specific color box target from the '''CTRL+K''' list.
 
}}
 
 
 
 
== Properties ==
 
== Properties ==
{{ArgsList
+
*'''.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.
| dd | Allows the color codes to be returned in double-digit format, eg: 02 instead of 2. Does not work on RGB-returned values.
+
== Names ==
}}
+
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:
 +
<source lang="mIRC">
 +
//echo -a $color(background)
 +
//echo -a $color(listbox)
 +
//echo -a $color(treebar)
 +
//echo -a $color(editbox)
 +
</source>
 +
The only names requiring 'text' are those where the absence of 'text' would be the same name as any of the above four:
 +
<source lang="mIRC">
 +
//echo -a $color(listbox text)
 +
//echo -a $color(treebar text)
 +
//echo -a $color(editbox text)
 +
</source>
 +
These names do not require quotes when used as the $color parameter, but do require quotes when used with echo's -c switch:
  
 +
<source lang="mIRC">/echo -ac "listbox text" test</source>
 
== Examples ==
 
== Examples ==
Echo the color code for action events:
+
Echo the color index number for action events:
 
<source lang="mIRC">//echo -a $color(action)</source>
 
<source lang="mIRC">//echo -a $color(action)</source>
 +
If Index 0-9 are used for that event, displays a single number unless the .dd property is used:
 +
<source lang="mIRC">//echo -a $color(action).dd
 +
</source>
  
Echo the RGB code for the 4th color box:
+
Echo the RGB code for index 4:
 
<source lang="mIRC">//echo -a $color(4)</source>
 
<source lang="mIRC">//echo -a $color(4)</source>
  
 +
<source lang="mIRC">
 +
//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
 +
</source>
 +
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.
 +
<source lang="mIRC">
 +
//var %string 123 | echo -a $chr(3) $+ $color(ctcp).dd $+ %string
 +
vs
 +
//var %string 123 | echo -a $chr(3) $+ $color(ctcp)  $+ %string
 +
</source>
 +
 +
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 ==
 
== Compatibility ==
Added: mIRC v5.3
+
{{mIRC compatibility|5.3}}
 
 
Added On: 13/12/97
 
 
 
 
== See Also ==
 
== See Also ==
* [[/color command - mIRC|/color]]
+
* {{mIRC|/color}}
{{mIRC identifier list}}
+
* {{mIRC|$colour}}
 
+
* {{mIRC|$rgb}}
[[Category:MIRC identifiers]]
+
* {{mIRC|/echo}}

Revision as of 22:40, 8 January 2019

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

$color(name/N)[.dd]

Parameters

  • 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-15 are displayed in the CTRL+K list and the ALT+K window.

Properties

  • .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

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

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

Added: mIRC v5.3
Added on: 13 Dec 1997
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.

See Also