Changes

Jump to navigation Jump to search
797 bytes added ,  15:04, 7 October 2019
m
→‎Defining New Colors: bit of visual cleanup
ConTeXt supports two color models: [http://en.wikipedia.org/wiki/RGB_color_model RGB] (typically used for screen display) and [http://en.wikipedia.org/wiki/CMYK_color_model CMYK] (typically used for printing). There is also support for [http://en.wikipedia.org/wiki/Spot_color spot colors] (typically used for offset printing) and transparencies.
= Warning Before you start ... =
1. It is usually a bad style to use explicit color switches in the text. It is better to define a semantic command that takes care of the color switching. For example, instead of using <code>\color[red]{important text}</code>, define
2. Colors are not enabled by default in MkII. To enabled colors in MkII, use
<texcode>\setupcolors[state=start]</texcode>
 
3. To disable colors in a document, use
<texcode>\setupcolors[state=stop]</texcode>
= Basic Usage =
etc.
= Disable color =
 
If you want to disable colors in a document, use
<texcode>\setupcolors[state=stop]</texcode>
= Pre-defined colors =
| {{src|colo-imp-x11.mkiv}}
| 658 extended Xorg color keywords (WWW), defined in hex RGB
|-
| crayola || <code>\usecolors[crayola] </code>
| {{src|colo-imp-crayola.mkiv}} || 235 Crayola (Binney & Smith) colors
|-
| ema || <code>\usecolors[ema]</code>
| {{src|colo-imp-ema.mkiv}} || 549 Emacs colors
|-
| RAL || <code>\usecolors[ral]</code>
| {{src|colo-imp-ral.mkiv}} || 213 RAL color system (Deutsches Institut für Gütesicherung und Kennzeichnung)
|-
| Solarized || <code>\usecolors[solarized]</code>
| {{src|colo-imp-solarized.mkiv}} || 16 solarized colors
|}
 
= Defining New Colors =
{| class="wikitable"
! Name !! Sytanx Syntax (and Example) !! Explanation
|-
| style="width:20%;" | RGB color model| style="width:40%;" | <texcode>\definecolor[...][r=..., g=..., b=...]</texcode>
For example,
<texcode>\definecolor[lime][r=0.75, g=1, b=0]
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).
|}
For example
{|
! width="45%"| ! width="10%"| ! width="45%"||<texcode>\usecolors[xwi]
\definecolor[highlight][yellow]
\defineframed
[important]
[location=low, frame=off, background=color, backgroundcolor=highlight]
This is a \important{important}word.
This is a \important{important}word.
</texcode>
| width="10%"|| width="45%"|<context mode=mkiv>\usecolors[xwi]
\definecolor[highlight][yellow]
\defineframed[important][location=low, frame=off, background=color, backgroundcolor=highlight]
This is a \important{important}word.
* [[Color/Transparency|Transparency]]
* [[Color/Spot_Colors|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 in the mailing list)
 
{{Getting started navbox}}

Navigation menu