ConTeXt supports several color models: [https://en.wikipedia.org/wiki/RGB_color_model RGB] (typically used for screen display),[https://en.wikipedia.org/wiki/CMYK_color_model CMYK] (typically used for printing) as well as [https://en.wikipedia.org/wiki/HSL_and_HSV HSV/HSL] and [https://en.wikipedia.org/wiki/HWB_color_model HWB]. There is also support for [https://en.wikipedia.org/wiki/Spot_color spot colors] (typically used for offset printing) and transparencies. __TOC__
= Before you start ... =
3. To disable colors in a document, use
<texcode>\setupcolors[state=stop]</texcode>
Last [[Documentation|manual dedicated to color]] was issued in 2016
ConTeXt Defining New Colors|supports several color models:
* [https://en.wikipedia.org/wiki/CMYK_color_model CMYK], typically used for printing
* [https://en.wikipedia.org/wiki/RGB_color_model RGB], [https://en.wikipedia.org/wiki/HSL_and_HSV HSV/HSL] and [https://en.wikipedia.org/wiki/HWB_color_model HWB], typically used for screen display,
* [[Transparency]] ([https://en.wikipedia.org/wiki/Transparency_(graphic) Transparency] on wikipedia).
* [[Spot Colors]] typically used for offset printing ([https://en.wikipedia.org/wiki/Spot_color Spot colors] on wikipedia).
| The values for <code>c</code>, <code>m</code>, <code>y</code> and <code>k</code> are floating point number between <code>0</code> and <code>1</code>.
| The value for <code>h</code> (hue) is between <code>0</code> and <code>360</code>; the values for <code>s</code> (saturation), <code>v</code> (value/brightness) are floating point numbers between <code>0</code> and <code>1</code>.
| The value for <code>h</code> (hue) is between <code>0</code> and <code>360</code>; the values for <code>w</code> (whiteness), <code>b</code> (blackness) are floating point numbers between <code>0</code> and <code>1</code>. This mostly unknown color model is also used in CSS3/SVG.
|-
| Hex
| <texcode>\definecolor[...][x=...]</texcode>
For example,
<texcode>\definecolor[lime][x=BFFF00]
This is \color[lime]{a new color}
that we defined</texcode>
| The value for <code>x</code> is a three-byte hexadecimal number where the bytes represent the red, green, and blue values. This follows the HTML and CSS style of defining colors.
|-
|Gray scale
|<texcode>\definecolor[...][s=...]</texcode>
For example,
<texcode>\definecolor[screen][s=0.5]
This is \color[screen]{a new color}
that we defined</texcode>
| The value for <code>s</code> is a floating point number between <code>0</code> and <code>1</code>, representing the grayness value (1 represents white, 0 represents black).
In addition to the above basic The colors are defined in {{src|colo-imp-xwi.mkiv}}. The name suggests that they were from some color, ConTeXt also includes a definition file distributed as part of the [httphttps://wwwen.w3wikipedia.org/TRwiki/2002/WD-css3-color-20020219/#x11-color X_Window_System X_Window_System]. These are a subset of the X11 colors], shown earlier. To load this list ({{src|colo-imp-xwi.mkiv}})these colors, use:
<texcode>\usecolors[xwi]</texcode>
== Additional pre-defined colors ==
In addition to the above, there are two other sets of pre-defined colors.
{| class="wikitable"
| x11 || <code>\usecolors[x11]</code>
| {{src|colo-imp-x11.mkiv}}
| 658 extended Xorg color keywords (WWW), defined in hex RGB
| The values for <code>c</code>, <code>m</code>, <code>y</code> and <code>k</code> are floating point number between <code>0</code> and <code>1</code>.
| The value for <code>h</code> (hue) is between <code>0</code> and <code>360</code>; the values for <code>s</code> (saturation), <code>v</code> (value/brightness) are floating point numbers between <code>0</code> and <code>1</code>.
| The value for <code>h</code> (hue) is between <code>0</code> and <code>360</code>; the values for <code>w</code> (whiteness), <code>b</code> (blackness) are floating point numbers between <code>0</code> and <code>1</code>. This mostly unknown color model is also used in CSS3/SVG.
|-
| Hex
| <texcode>\definecolor[...][x=...]</texcode>
For example,
<texcode>\definecolor[lime][x=BFFF00]
This is \color[lime]{a new color}
that we defined</texcode>
| The value for <code>x</code> is a three-byte hexadecimal number where the bytes represent the red, green, and blue values. This follows the HTML and CSS style of defining colors.
|-
|Gray scale
|<texcode>\definecolor[...][s=...]</texcode>
For example,
<texcode>\definecolor[screen][s=0.5]
This is \color[screen]{a new color}
that we defined</texcode>
| The value for <code>s</code> is a floating point number between <code>0</code> and <code>1</code>, representing the grayness value (1 represents white, 0 represents black).
% Define the actual color based on variables: \definecolor[ColorName][% r= References {\mathexpr[.3N]{\getvariable{ColorName}{r}/255}}, g={\mathexpr[.3N]{\getvariable{ColorName}{g}/255}}, b={\mathexpr[.3N]{\getvariable{ColorName}{b}/255}},]% % Test it: \startTEXpage[offset=5mm] \framed[foregroundcolor=white, background=color, backgroundcolor=ColorName]{Hello WORLD!} \\\colorcomponents{ColorName}\stopTEXpage</context>
* [http://paletton.com Paletton] - Website to choose color palettes* [http://colorbrewer2.org/ ColorBrewer] - website to choose colors for maps = Further reading and graphics.specialized topics =
* [[Transparency]] * [[Spot Colors]]* References** [http://paletton.com Paletton] - website to choose color palettes** [http://colorbrewer2.org/ ColorBrewer] - website to choose colors for maps and graphics** Tina Sutton, Bride M Whelan: The Complete Color Harmony. Rockport Publishers (2004). ISBN 978-1592530311 (recommanded recommended in the mailing list)