From WikiChip
Editing mirc/identifiers/$color

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
{{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.
+
The '''$color''' identifier allows mIRC to return the proper color code associated with the specified target.
  
 
== Synopsis ==
 
== Synopsis ==
<pre>$color(name/N)[.dd]</pre>
+
<pre>$color(name/N)[.property]</pre>
 +
 
 
== Parameters ==
 
== Parameters ==
* '''name''' Returns the color index number for the specified name/action/event. Partial matches work as well: '''$color(action)'''
+
{{ArgsList
* '''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.
+
| name | Returns the color code for the specified name/action/event. Partial matches work as well: '''$color(action)'''
 +
| 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 ==
*'''.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.
+
{{ArgsList
== Names ==
+
| dd | Allows the color codes to be returned in double-digit format, eg: 02 instead of 2. Does not work on RGB-returned values.
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 index number for action events:
+
Echo the color code 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 index 4:
+
Echo the RGB code for the 4th color box:
 
<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 ==
{{mIRC compatibility|5.9}}
+
{{mIRC compatibility|5.3}}
  
 
== See Also ==
 
== See Also ==
 
* {{mIRC|/color}}
 
* {{mIRC|/color}}
* {{mIRC|$colour}}
+
{{mIRC identifier list}}
* {{mIRC|$rgb}}
+
 
* {{mIRC|/echo}}
+
[[Category:MIRC identifiers]]

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)