Changes

Jump to navigation Jump to search
1,176 bytes added ,  13:46, 8 June 2020
m
Reverted edits by Garulfo (talk) to last revision by Hraban
}}
== [[Help:Reference|Syntax]] (autogenerated) ==
<syntax>definecolor</syntax>
== [[Help:Reference|Syntax]] ==
<table cellspacing="4" cellpadding="2" class="cmd">
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:r|r]]</td> <td>[[Reference/enCommand/value:number|number]] red channel (RGB)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:g|g]]</td> <td>[[Reference/enCommand/value:number|number]] green channel (RGB)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:b|b]]</td> <td>[[Reference/enCommand/value:number|number]] blue channel (RGB)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:c|c]]</td> <td>[[Reference/enCommand/value:number|number]] cyan channel (CMYK)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:m|m]]</td> <td>[[Reference/enCommand/value:number|number]] magenta channel (CMYK)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:y|y]]</td> <td>[[Reference/enCommand/value:number|number]] yellow channel (CMYK)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:k|k]]</td> <td>[[Reference/enCommand/value:number|number]] black channel (CMYK)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:s|s]]</td> <td>[[Reference/enCommand/value:number|number]] gray value (Grayscale), if v isn't set</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:h|h]]</td> <td>[[Reference/enCommand/value:number|number]] hue (HSB/HWB, 0–360)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:s|s]]</td> <td>[[Reference/enCommand/value:number|number]] saturation (HSB)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:v|v]]</td> <td>[[Reference/enCommand/value:number|number]] brightness/value (HSB), blackness (HWB)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:tw|tw]]</td> <td>[[Reference/enCommand/value:number|number]] transparency factorwhiteness (HWB)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:at|at]]</td> <td>[[Reference/enCommand/value:number|number]] alternative (transparency method)factor</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:pa|pa]]</td> <td>[[Reference/enCommand/value:number|number]] spotcolor percentagealternative (transparency method)</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[Reference/enCommand/keyword:ep|ep]]</td> <td>[[Reference/enCommand/value:textnumber|textnumber]] spotcolor namepercentage</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[[ReferenceCommand/enkeyword:e|e]]</td> <td>[[Command/value:text|text]] spotcolor name</td> </tr> <tr valign="top" class="second"> <td class="cmd">[[Command/keyword:x|x]]</td> <td>[[Reference/enCommand/value:text|text]] Hexadecimal RGB value (like in HTML), only with hex module</td>
</tr>
</table>
 
== Description ==
<code>\color</code> command.
 ===Hex colors in MkII===To use hexadecimal colors in mkii MkII you need to load the proper module first:
<texcode>
Then the colors can be specified with
<texcode>
\definecolor[hex-red][h=FF0000]% it’s h instead of x in MkII
</texcode>
===Transparency=== Regarding the key « {{code|a »}}, which means transparency alternativemethod, there are a certain number of values (actually at least 13, from 0 to 12) whose meanings can be seen from below:
<texcode>
\definetransparency [difference] [11]
\definetransparency [exclusion] [12]
</texcode>
 
=== Defining derivative colors ===
 
Colors defined in terms of other colors are processed at the Lua end, unless they are direct clones. In that case, the new name is never told to Lua. That means that this does not work:
<texcode>
% direct clone, processed by TeX
\definecolor[ColorA][red]
% fails, ColorA not known to Lua
\definecolor[ColorB][.5(ColorA)]
</texcode>
 
Writing it as a fake fraction works.
 
<texcode>
% definition involves a fraction, processed by Lua.
\definecolor[ColorA][1.0(red)]
% succeeds
\definecolor[ColorB][.5(ColorA)]
</texcode>
== Example ==
<context source=yes mode=mkiv>% rgb\definecolor[bluu][r=.25, g=.1, b=1]Hey, \color[bluu]{look at that!-- Please fill in an example if } % hex\definecolor[salmon][x=AB5757]Hey, \color[salmon]{look at that!} \definecolor[brightorange][c=0, m=.4325, y=.9286, k=.0118]Hey, \color[brightorange]{orange you can --glad I didn't say banana?} \definecolor[darknavy][c=.9753, m=.4444, y=0, k=.6824]Hey, \color[darknavy]{is this dark navy?}</context>
== See also ==
<!-- something like * [[Color]]* {{cmd:goto|\goto]] definetransparency}} == Help from ConTeXt-->Mailinglist/Forum ==All issues with:[[Colors]], [[Reference/en/definetransparency]]{{Forum|{{SUBPAGENAME}}}}
[[Category:ReferenceCommand/enColors|definecolor]]

Navigation menu