Debian Codegraph @

texmf-dist/source/latex/xcolor/xcolor.dtx

raw
1 % \iffalse meta-comment
2 %%
3 %% ----------------------------------------------------------------
4 %% Copyright (C) 2003-2021 by Dr. Uwe Kern <xcolor at ukern dot de>
5 %% 2021-2024 LaTeX Project https://github.com/latex3/xcolor/issues
6 %% ----------------------------------------------------------------
7 %%
8 %<*package>
9 %% Please send error reports and suggestions for
10 %% improvements to https://github.com/latex3/xcolor/issues.
11 %%
12 %% This package contains code copied from
13 %%
14 %% color.dtx [1999/02/16 v1.0i Standard LaTeX Color (DPC)]
15 %% Copyright (C) 1994--1999 David Carlisle
16 %%
17 %% which is part of the Standard LaTeX `Graphics Bundle'.
18 %%
19 %</package>
20 %<*extract|driver|test1|test2|test3|test4>
21 \def\XCfileversion{v3.02}%
22 \def\XCfiledate{2024/09/29}%
23 %</extract|driver|test1|test2|test3|test4>
24 %
25 % This file may be distributed and/or modified under the
26 % conditions of the LaTeX Project Public License, either version 1.3c
27 % of this license or (at your option) any later version.
28 % The latest version of this license is in:
29 %
30 % http://www.latex-project.org/lppl.txt
31 %
32 % and version 1.3c or later is part of all distributions of LaTeX
33 % version 2008-05-04 or later.
34 %
35 % \fi
36 %
37 %
38 % \DoNotIndex{\def,\gdef,\edef,\xdef,\long,\let}
39 % \DoNotIndex{\ifnum,\ifdim,\iftrue,\iffalse,\ifx,\ifcase,\else,\or,\fi}
40 % \DoNotIndex{\bgroup,\egroup,\begingroup,\endgroup,\begin,\end}
41 % \DoNotIndex{\relax,\endinput}
42 % \DoNotIndex{\csname,\endcsname,\string,\the,\noexpand,\expandafter}
43 % \DoNotIndex{\advance,\count,\dimen}
44 % \DoNotIndex{\m@ne,\z@,\@ne,\tw@,\p@,\@@tmp}
45 %
46 % \CharacterTable
47 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
48 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
49 % Digits \0\1\2\3\4\5\6\7\8\9
50 % Exclamation \! Double quote \" Hash (number) \#
51 % Dollar \$ Percent \% Ampersand \&
52 % Acute accent \' Left paren \( Right paren \)
53 % Asterisk \* Plus \+ Comma \,
54 % Minus \- Point \. Solidus \/
55 % Colon \: Semicolon \; Less than \<
56 % Equals \= Greater than \> Question mark \?
57 % Commercial at \@ Left bracket \[ Backslash \\
58 % Right bracket \] Circumflex \^ Underscore \_
59 % Grave accent \` Left brace \{ Vertical bar \|
60 % Right brace \} Tilde \~}
61 %
62 %
63 % \iffalse
64 %<*batchfile>
65 \IfFileExists{xcolor.ins}{\let\uknext=\relax}{\let\uknext=\stop}
66 \begin{filecontents*}{xcolor.ins}
67 %% Package `xcolor' by Dr. Uwe Kern
68 %%
69 %% Extract all package files:
70 %% `latex xcolor.ins'
71 %%
72 %% Put the generated files to their respective locations
73 %% within the TeX installation:
74 %% *.sty -> /tex/latex/xcolor/
75 %% *.def -> /tex/latex/xcolor/
76 %% *.pro -> /dvips/xcolor/
77 %%
78 %% Create the documentation:
79 %% `latex xcolor.dtx'
80 %% `latex xcolor.dtx'
81 %% `makeindex -s gind.ist xcolor.idx'
82 %% `latex xcolor.dtx'
83 %% `latex xcolor.dtx'
84 %%
85 %% Run the test files (N=1,2,...):
86 %% `latex xcolorN.tex'
87 %% `latex xcolorN.tex'
88 %%
89 \def\batchfile{xcolor.ins}
90 \input docstrip.tex
91 \askforoverwritefalse
92 \generate{\file{xcolor.lox}{\from{xcolor.dtx}{extract}}}
93 \batchinput{xcolor.lox}
94 \endbatchfile
95 \end{filecontents*}
96 %</batchfile>
97 %
98 %<*driver>
99 \listfiles
100 \ProvidesFile{xcolor.dtx}[\XCfiledate\space\XCfileversion\space
101 `xcolor' source and documentation (UK)]
102 \PassOptionsToPackage
103 {
104 hyperindex=false,bookmarks,bookmarksopen,bookmarksopenlevel=1,%
105 pdftitle={xcolor \XCfileversion{} (\XCfiledate)},
106 pdfauthor={Dr. Uwe Kern},%
107 pdfsubject={Color extensions for LaTeX and pdfLaTeX},%
108 pdfkeywords={xcolor,color,colour,model,tint,tone,shade,harmony,spot,latex,pdftex,dvips,%
109 conversion,blend,mix,mask,separation,rgb,cmy,cmyk,hsb,gray,html,wave,thsb,wheel}
110 }{hyperref}
111 \documentclass{ltxdoc}
112 \usepackage[table,showerrors,dvipsnames,hyperref]{xcolor}[2005/06/06]
113 \usepackage{chngpage,varioref,tabularx,amsmath,amsthm}
114 \OnlyDescription
115 \EnableCrossrefs
116 \CodelineIndex
117 \makeatletter
118 \def\Meaning#1{\texttt{\expandafter\expandafter\expandafter\strip@prefix\expandafter\meaning\csname #1\endcsname}}
119 \makeatother
120 \pagestyle{myheadings}
121 \markright{\hskip-2.5cm xcolor \XCfileversion\space(\XCfiledate)}
122 \begin{document}
123 \DocInput{xcolor.dtx}
124 \let\Section\section\def\section*#1{\Section*{#1}\addcontentsline{toc}{section}{#1}}
125 \begin{adjustwidth}{-2.5cm}{}
126 \def\markboth#1#2{}\PrintIndex
127 \end{adjustwidth}
128 \end{document}
129 %</driver>
130 %
131 %<*extract>
132 \def\ukfile#1#2#3#4%
133 {\def\ukhead
134 {\ifnum#1>2 \perCent!^^J\fi
135 \defaultpreamble^^J\MetaPrefix^^J%
136 \ifcase#1
137 \string\ProvidesPackage{#2}^^J\or
138 \string\ProvidesFile{#2}^^J\or
139 \string\ProvidesFile{#2.def}^^J\or
140 \MetaPrefix\space #2.pro (PostScript/dvips header file)^^J\MetaPrefix\space
141 \fi
142 \space[\XCfiledate\space\XCfileversion\space#4\space(UK)]}
143 \usepreamble\ukhead
144 \file{#2.\ifcase#1sty\or tex\or def\or pro\fi}{\from{xcolor.dtx}{#3}}}
145 \generate{
146 \ukfile0{xcolor}{package}{LaTeX color extensions}
147 \ukfile2{svgnam}{svgnames}{Predefined colors according to SVG 1.1}
148 \ukfile2{x11nam}{x11names}{Predefined colors according to Unix/X11}
149 \ukfile1{xcolor1}{test1}{Color conversion test}
150 \ukfile1{xcolor2}{test2}{Pstricks color test}
151 \ukfile1{xcolor3}{test3}{Color logging test}
152 \ukfile1{xcolor4}{test4}{Color driver test}
153 \def\PStail{\MetaPrefix\space End of file `\outFileName'.}
154 \usepostamble\PStail
155 \ukfile3{xcolor}{dvips}{LaTeX color extensions}
156 }
157 %</extract>
158 % \fi
159 %
160 %
161 %
162 % \iffalse
163 %-------------------------------------------------------------------------------
164 % \fi
165 %
166 %
167 % \makeatletter
168 %
169 % \def\testclr#1#{\@testclr{#1}}
170 % \def\@testclr#1#2{{\fboxsep\z@\fbox{\colorbox#1{#2}{\phantom{XX}}}}}
171 % \def\Testclr#1#{\@Testclr{#1}}
172 % \def\@Testclr#1#2#3{\testclr#1{#2}~\rlap{\Color[-]{#3}}\\}
173 % \def\TestClr#1#{\@TestClr{#1}}
174 % \def\@TestClr#1#2#3{\testclr#1{#2}~\rlap{\Color[+]{#3}}\\}
175 % \newif\if@Meta
176 % \DeclareRobustCommand*\Meta{\@ifstar{\@Metatrue\@Meta}{\@Metafalse\@Meta}}
177 % \newcommand*\@Meta[2][]{\meta{#2}\@ifxempty{#1}{}{\ensuremath{\mskip-1mu\rule[-.4ex]{0pt}{1ex}_{#1}}}\if@Meta\index{arguments\levelchar\meta{#2}\string|usage}\fi}
178 % \def\DescribeArg#1{\leavevmode\@bsphack\marginpar{\raggedleft\Meta*{#1}}\@esphack\ignorespaces}
179 % \def\DescribeFunc#1{\leavevmode\@bsphack\marginpar{\raggedleft\Function{#1}\strut}\@esphack\ignorespaces}
180 %
181 % \makeatother
182 %
183 % \def\Index#1{#1\index{#1\string|usage}}
184 % \def\Package#1{\textsf{#1}\index{packages\levelchar\textsf{#1}\string|usage}}
185 % \def\Program#1{\textsf{\itshape#1}\index{programs\levelchar\textsf{\itshape#1}\string|usage}}
186 % \def\Model#1{\textsf{\bfseries#1}\index{color models\levelchar\textsf{\bfseries#1}\string|usage}}
187 % \def\nModel#1{`#1'\index{color models\levelchar`#1'\string|usage}}
188 % \def\pModel#1{\textbf{\itshape #1}}
189 % \def\People#1#2{#1 #2\index{people\levelchar#2, #1\string|usage}}
190 % \newcommand*\Color[2][+]{\textsl{#2}\ifx#1+\index{color names\levelchar\textsl{#2}\string|usage}\fi}
191 % \def\Option#1{\texttt{#1}\index{package options\levelchar\texttt{#1}\string|usage}}
192 % \def\oOption#1{\texttt{#1}\index{package options (obsolete)\levelchar\texttt{#1}\string|usage}}
193 % \def\Key#1{\textit{#1}\index{keys\levelchar\textit{#1}\string|usage}}
194 % \def\File#1{\texttt{#1}\index{files\levelchar\texttt{#1}\string|usage}}
195 % \def\Function#1{\textit{#1}\index{color functions\levelchar\textit{#1}\string|usage}}
196 % \def\Op#1#2{#1\nolimits_{\,\Model{#2}}}
197 % \def\med{\mathop{\textrm{med}}}
198 % \def\mix{\mathop{\textrm{mix}}}
199 % \def\rd{\mathop{\textrm{round}}}
200 % \def\tint{\mathop{\textrm{tint}}}
201 % \def\shade{\mathop{\textrm{shade}}}
202 % \def\tone{\mathop{\textrm{tone}}}
203 % \def\LC{\Package{color}}
204 % \def\LCP{\Package{color} package}
205 % \def\XC{\Package{xcolor}}
206 % \def\XCP{\Package{xcolor} package}
207 % \def\XCW{\texttt{\href{http://www.ukern.de/tex/xcolor.html}{www.ukern.de/tex/xcolor.html}}}
208 % \def\URL#1{\texttt{\url{#1}}}
209 % \def\CTAN#1#2{\texttt{\href{http://www.ctan.org/tex-archive/#1}{CTAN/#1#2}}}
210 % \newtheorem{lemma}{Lemma}
211 % \def\RtoI#1{\Gamma_{\!#1}}
212 % \def\ItoR#1{\Delta_{#1}}
213 % \def\bbbN{\textrm{I\kern-.333ex N}}
214 % \def\bbbR{\textrm{I\kern-.333ex R}}
215 % \def\Circ{\textsuperscript{$\circ$}}
216 %
217 % \newdimen\XCdim
218 %
219 % \parindent0pt
220 % \extrarowheight1pt
221 % \def\textfraction{0.01}
222 % \def\topfraction{0.99}
223 % \def\bottomfraction{0.99}
224 % \def\floatpagefraction{0.70}
225 % \setlength\abovecaptionskip{12pt}
226 % \setlength\belowcaptionskip{10pt}
227 % \colorlet{tableheadcolor}{gray!25}
228 % \colorlet{tablerowcolor}{gray!12.5}
229 %
230 %
231 %
232 % \title{Extending \LaTeX's color facilities: the \XCP}
233 % \author{\href{mailto:[email protected]}{\fboxrule0pt\fboxsep2pt\fbox{Dr. Uwe Kern}}}
234 % \date{\XCfileversion{} (\XCfiledate)
235 % \thanks{This package can be downloaded from \CTAN{macros/latex/contrib/xcolor/}{}.
236 % There is also an \textsf{xcolor} homepage: \XCW.
237 % Please send error reports and suggestions for improvements to:
238 % \url{https://github.com/latex3/xcolor/issues}.}}
239 % \maketitle
240 %
241 % \begin{abstract}
242 % \noindent
243 % \XC{} provides easy driver-independent access to several kinds of colors, tints, shades, tones, and mixes of arbitrary colors by means of color expressions like |\color{red!50!green!20!blue}|.
244 % It allows to select a document-wide target color model and offers tools for automatic color schemes, conversion between twelve color models, alternating table row colors, color blending and masking, color separation, and color wheel calculations.
245 % \end{abstract}
246 %
247 % \phantomsection\pdfbookmark[1]{\contentsname}{toc}
248 % \tableofcontents\listoftables\listoffigures\newpage
249 %
250 %
251 %
252 %
253 % \clearpage
254 % \section{Introduction}
255 %
256 % \subsection{Purpose of this package}
257 %
258 % The \LCP{} provides a powerful and stable tool for handling colors within (pdf)\LaTeX{} in a consistent and driver-independent way, supporting several color models (slightly less driver-independent).
259 %
260 % Nevertheless, it is sometimes a bit clumsy to use, especially in cases where slight color variations, color mixes or color conversions are involved:
261 % this usually implies the usage of another program that calculates the necessary parameters, which are then copied into a |\definecolor| command in \LaTeX.
262 % Quite often, also a pocket calculator is involved in the treatment of issues like the following:
263 % \begin{itemize}
264 % \item My company has defined a corporate color, and the printing office tells me how expensive it is to use more than two colors in our new brochure, whereas all kinds of tints (e.g., a 75\% version) of our color can be used at no extra cost.
265 % But how to access these color variations in \LaTeX?\\
266 % (Answer: |\color{CorporateColor!75}| etc.)
267 % \item My friend uses a nice color which I would like to apply in my own documents; unfortunately, it is defined in the \Model{hsb} model which is not supported in my favorite application pdf\LaTeX.
268 % What to do now?\\
269 % (Answer: just use the \Model{hsb} definitions, \XC{} will do the necessary calculations)
270 % \item How does a mixture of 40\% \Color{green} and 60\% \Color{yellow} look like?\\
271 % (Answer: 40\% \testclr{green} $+$ 60\% \testclr{yellow} $=$ \testclr{green!40!yellow}, e.g., |\color{green!40!yellow}|)
272 % \item And how does its complementary color look like?\\
273 % (Answer: \testclr{-green!40!yellow}, accessible via |\color{-green!40!yellow}|)
274 % \item Now I want to mix three parts of the last color with two parts of its complement and one part of \Color{red}.
275 % How does that look?\\
276 % (Answer: $3\times$ \testclr{-green!40!yellow} $+ 2\times$ \testclr{green!40!yellow} $+ 1\times$ \testclr{red} $=$ \testclr{rgb:-green!40!yellow,3;green!40!yellow,2;red,1}, the last color being accessible via |\color{rgb:-green!40!yellow,3;green!40!yellow,2;red,1}|)
277 % \item I know that light waves of 485nm are within the visible range. But which color do they represent?\\
278 % (Answer: approximately \testclr[wave]{485}, via |\color[wave]{485}|)
279 % \item My printing office wants all color definitions in my document to be transformed into the \Model{cmyk} model.
280 % How can I do the calculations efficiently?\\
281 % (Answer: |\usepackage[cmyk]{xcolor}| or |\selectcolormodel{cmyk}|)
282 % \item I have a table with 50 rows.
283 % How can I get alternating colors for entire rows without copying 50 |\rowcolor| commands? The alternating scheme should start in the 3rd row.\\
284 % (Answer: something like |\rowcolors{3}{OddColor}{EvenColor}|)
285 % \end{itemize}
286 % These are some of the issues solved by the \XCP.
287 % Its purpose can be summarized as to maintain the characteristics of \LC, while providing additional features and flexibility with (hopefully) easy-to-use interfaces.
288 %
289 %
290 %
291 % \subsection{Color tints, shades, tones, and complements}
292 %
293 % According to \cite{smith} we define the terms
294 % \begin{itemize}
295 % \item \textbf{\Index{tint}}: a color with \Color{white} added,
296 % \item \textbf{\Index{shade}}: a color with \Color{black} added,
297 % \item \textbf{\Index{tone}}: a color with \Color{gray} added.
298 % \end{itemize}
299 % These are special cases of a general function
300 % $\mix(C,C',p)$ which constructs a new color, consisting of $p$ parts of color $C$ and $1-p$ parts of color $C'$, where $0\le p\le1$.
301 % Thus, we set
302 % \begin{align}
303 % \tint(C,p) &:= \mix(C,|white|,p)\\
304 % \shade(C,p) &:= \mix(C,|black|,p)\\
305 % \tone(C,p) &:= \mix(C,|gray|,p)
306 % \end{align}
307 % where |white|, |black|, and |gray| are model-specific constants, see table \vref{tab.const}.
308 % Further we define the term
309 % \begin{itemize}
310 % \item \textbf{complement}: a color $C^*$ that yields \Color{white} if superposed with the original color $C$,
311 % \end{itemize}
312 % knowing that there are also different concepts of complementarity in place (e.g., opposite colors on \emph{color wheels}).
313 % See section \vref{sec.cnv} for calculation details and section \vref{sec.harmony} for some remarks on color wheels.
314 %
315 %
316 %
317 % \subsection{Color models}
318 %
319 % A color model is a tool to describe or represent a certain set of colors in a way that is suitable for the desired target device, e.g., a screen or a printer.
320 % There are proprietary models (like \Index{Pantone} or \Index{HKS}) that provide finite sets of colors (often called \emph{\Index{spot color}s}), where the user has to choose from without caring about parametrisations; on the other hand, there are parameter-driven models like \Model{gray}, \Model{rgb}, and \Model{cmyk}, that aim to represent large finite or even (theoretically) infinite sets of colors, built on very small subsets of base colors and rules, how to construct other colors from these base colors.
321 % For example, a large range of colors can be constructed by linear combinations of the base colors \Color{red}, \Color{green}, and \Color{blue}.
322 % On the other hand, usually \Index{spot color}s can only be \emph{approximated} by parameter values in models like \Model{cmyk} or \Model{rgb}; the original colors are being physically mixed even dependent on the targeted kind of paper.
323 % Finally, there are certain colors like \Color{gold} and \Color{silver} that are hardly reproducible by any parameter-driven color model on standard ink or laser printers.
324 %
325 %
326 %
327 % \subsection{Color wheels and color harmony}\label{sec.harmony}
328 %
329 % There has been a long history of placing colors (hues) on wheels in order to discuss theoretical or practical color issues (e.g., \People{Isaac}{Newton}, \People{Johann Wolfgang von}{Goethe}).
330 % One reason may be that the circle itself is a natural tool to demonstrate common relationships as well as opposite properties.
331 %
332 % Nowadays, there exists some confusion about notions, since both major areas related to color --- art and graphics design on one hand, scientific color theory on the other hand --- tend to use the same words to describe color properties, however meaning sometimes very different facts!
333 % Thus, the appearance of color wheels differs as well as the meaning of concepts like `primary' or `complementary' colors.
334 %
335 %
336 % \paragraph{Typical color wheel construction}
337 % First, three \emph{primary colors} are placed at 0\Circ, 120\Circ, 240\Circ (artists often choose \Color{red}, \Color{yellow}, \Color{blue}, whereas color scientists might prefer \Color{red}, \Color{green}, \Color{blue}).
338 % Next, three \emph{secondary colors} are put at 60\Circ, 180\Circ, 300\Circ.
339 % Then, six \emph{tertiary colors} may be placed in between (30\Circ, 90\Circ, \dots).
340 % This is why color wheels are frequently described to consist of twelve equidistant colors, although the algorithm can be repeated arbitrarily often.
341 %
342 %
343 % \paragraph{Color harmonies derived from a wheel}
344 % We start with an arbitrary color wheel:
345 % \begin{itemize}
346 % \item \textbf{complementary colors} have a distance of 180\Circ{} on the wheel,
347 % \item \textbf{color triads} consist of three colors in 120\Circ{} steps,
348 % \item \textbf{color tetrads} consist of four colors in 90\Circ{} steps.
349 % \end{itemize}
350 % We assume now that the wheel is partitioned into $2n$ sectors of equal size:
351 % \begin{itemize}
352 % \item \textbf{split complementary colors} of a given color are the two immediate neighbours of its complementary color, characterised by the positions $\frac{n\pm1}{2n}\cdot360^\circ$,
353 % \item \textbf{analogous colors} to a given color are its two or four neighbours, characterised by the positions $\pm\frac{1}{2n}\cdot360^\circ$ and $\pm\frac{2}{2n}\cdot360^\circ$.
354 % \end{itemize}
355 % Given these methods to generate `color harmonies', we conclude that the results depend heavily on how we constructed the wheel!
356 % Moreover, the choice of $n$ will affect the visual results as well.
357 % Examples are shown in figure \vref{fig.harmony}.
358 %
359 %
360 %
361 %
362 % \clearpage
363 % \section{The User Interface}
364 %
365 % \subsection{Preparation}
366 %
367 % \subsubsection{Package installation}
368 %
369 % First of all, put \File{xcolor.sty} and all the \File{.def} files to some place where (pdf)\LaTeX{} finds them.
370 % A typical place according to the \emph{\TeX\ Directory Structure} (TDS) would be the directory |texmf/tex/latex/xcolor|, where |texmf| denotes the main directory of your \TeX\ installation.
371 % Additionally, put \File{xcolor.pro} to a place where \Program{dvips} finds it, typically |texmf/dvips/xcolor|.
372 % Usually, you will have to run some kind of filename database update in order to make the files known and quickly searchable to the \TeX\ system.
373 % Then simply use \XC{} (instead of \LC) in your document.
374 % Thus, the general command is |\usepackage|\oarg{options}|{xcolor}| in the document preamble.
375 % Table \vref{tab.package} shows what has to be taken into account with respect to the package loading order.
376 %
377 %
378 % \subsubsection{Package options}
379 %
380 % In general, there are several types of options:
381 % \begin{itemize}
382 % \item options that determine the color driver as explained in \cite{dpc} and \cite{color}, currently: \Option{dvips}, \Option{xdvi}, \Option{dvipdf}, \Option{dvipdfm}, \Option{dvipdfmx}, \Option{luatex}, \Option{pdftex}, \Option{dvipsone}, \Option{dviwindo}, \Option{emtex}, \Option{dviwin}, \Option{oztex}, \Option{textures}, \Option{pctexps}, \Option{pctexwin}, \Option{pctexhp}, \Option{pctex32}, \Option{truetex}, \Option{tcidvi}, \Option{vtex}, \Option{xetex}, \Option{dvisvgm},
383 % \item options that determine the target color model\footnote{Section \vref{sec.tgt} explains how this setting can be overridden at any point in a document.} (\Option{natural}, \Option{rgb}, \Option{cmy}, \Option{cmyk}, \Option{hsb}, \Option{gray}, \Option{RGB}, \Option{HTML}, \Option{HSB}, \Option{Gray}) or disable colored output (\Option{monochrome}),
384 % \item options that control whether and how certain sets of predefined colors are being loaded: \Option{dvipsnames}, \Option{dvipsnames*}, \Option{svgnames}, \Option{svgnames*}, \Option{x11names}, \Option{x11names*},
385 % \item option that determine which other packages are to be loaded or supported: \Option{table},
386 % \item options that influence the behaviour of other commands: \Option{prologue}, \Option{kernelfbox}, \Option{xcdraw}, \Option{noxcdraw}, \Option{fixinclude}, \Option{showerrors}, \Option{hideerrors},
387 % \item obsolete options:
388 % \oOption{pst},
389 % \oOption{override}, \oOption{usenames}, \oOption{nodvipsnames}, \oOption{fixpdftex}, \oOption{hyperref}.
390 % \end{itemize}
391 % All available package options (except driver selection and obsolete options) are listed in table \vref{tab.opt}.
392 % \DescribeMacro\GetGinDriver
393 % \DescribeMacro\GinDriver
394 % In order to facilitate the co-operation with the \Package{hyperref} package, there is a command |\GetGinDriver|\footnote{This command is executed automatically if the package option \Option{hyperref} is used.} that grabs the driver actually used and puts it into the command |\GinDriver|.
395 % The latter can then be used within \Package{hyperref} (or other packages), see the code example on page \pageref{ex.range}.
396 % If there is no corresponding \Package{hyperref} option, \Option{hypertex} will be taken as default.
397 %
398 % Warning: there is a substantial difference between \XC{} and \LC{} regarding how the \Option{dvips} option is being handled.
399 % The \LCP{} implicitly invokes the \Option{dvipsnames} option, whenever one of the |dvips|, |oztex|, |xdvi| drivers is selected.
400 % This makes documents less portable, since whenever one of these colors is used without explicit \Option{dvipsnames} option, other drivers like |pdftex| will issue error messages because of unknown colors.
401 % Therefore, \XC{} always requires an explicit \Option{dvipsnames} option to use these names --- which then works for all drivers.
402 %
403 %
404 % \begin{table}[p]\caption{Package options}\label{tab.opt}
405 % \extrarowheight2pt
406 % \begin{adjustwidth}{-2.5cm}{}
407 % \advance\textwidth2.5cm
408 % \rowcolors{3}{tablerowcolor}{}
409 % \begin{tabularx}{\linewidth}{lX}
410 % \hline
411 % \rowcolor{tableheadcolor}
412 % \em Option & \em Description\\
413 % \Option{natural}& (Default.) Keep all colors in their model, except \Model{RGB} (converted to \Model{rgb}), \Model{HSB} (converted to \Model{hsb}), and \Model{Gray} (converted to \Model{gray}).\\
414 % \Option{rgb}& Convert all colors to the \Model{rgb} model.\\
415 % \Option{cmy}& Convert all colors to the \Model{cmy} model.\\
416 % \Option{cmyk}& Convert all colors to the \Model{cmyk} model.\\
417 % \Option{hsb}& Convert all colors to the \Model{hsb} model.\\
418 % \Option{gray}& Convert all colors to the \Model{gray} model. Especially useful to simulate how a black \& white printer will output the document.\\
419 % \Option{RGB}& Convert all colors to the \Model{RGB} model (and afterwards to \Model{rgb}).\\
420 % \Option{HTML}& Convert all colors to the \Model{HTML} model (and afterwards to \Model{rgb}).\\
421 % \Option{HSB}& Convert all colors to the \Model{HSB} model (and afterwards to \Model{hsb}).\\
422 % \Option{Gray}& Convert all colors to the \Model{Gray} model (and afterwards to \Model{gray}).\\
423 % \hline
424 % \Option{dvipsnames}, \Option{dvipsnames*}& Load a set of predefined colors.\footnotemark[1]\\
425 % \Option{svgnames}, \Option{svgnames*}& Load a set of predefined colors according to \Index{SVG} 1.1.\footnotemark[1]\\
426 % \Option{x11names}, \Option{x11names*}& Load a set of predefined colors according to \Index{Unix}/\Index{X11}.\footnotemark[1]\\
427 % \hline
428 % \Option{table}& Load the \Package{colortbl} package, in order to use the tools for coloring rows, columns, and cells within tables.\\
429 % \Option{fixpdftex}& This option is obsolete and does nothing at all.\\
430 % \Option{hyperref}& Support the \Package{hyperref} package in terms of color expressions by defining additional keys (see section \vref{sec.hyperref}).\\
431 % \hline
432 % \Option{prologue}& Write prologue information to \File{.xcp} file for every color definition (as described in section \vref{sec.prologue}).\\
433 % \hline
434 % \Option{kernelfbox}& Use \LaTeX{} kernel method to draw \texttt{\string\f(rame)box} frames\footnotemark[2].\\
435 % \Option{xcdraw}& Use driver-specific commands to draw frames and color boxes.\footnotemark[2]\\
436 % \Option{noxcdraw}& (Default.) Use generic code to draw frames and color boxes.\footnotemark[2]\\
437 % \Option{fixinclude}& Prevent |dvips| color reset before \File{.eps} file inclusion (see section \vref{sec.fixinclude}).\\
438 % \hline
439 % \Option{showerrors}& (Default.) Display an error message if an undefined color is being used (same behaviour as in the original \LCP).\\
440 % \Option{hideerrors}& Display only a warning if an undefined color is being used, and replace this color by \Color{black}.\\
441 % \hline\hline
442 % \multicolumn2{c}{\footnotemark[1]\,See section \vref{sec.additionalcolors}.\quad \footnotemark[2]\,See section \vref{sec.fbox}.}\\
443 % \hline
444 % \end{tabularx}
445 % \end{adjustwidth}
446 % \end{table}
447 %
448 %
449 % \begin{table}[htbp]\caption{Package loading order}\label{tab.package}
450 % \begin{adjustwidth}{-2.5cm}{}
451 % \raggedleft
452 % \extrarowheight2pt
453 % \rowcolors{3}{tablerowcolor}{}
454 % \begin{tabular}{l*{5}{c}}
455 % \hline
456 % \rowcolor{tableheadcolor}
457 % \em Action/Package & \Package{colortbl}& \Package{hyperref}& \Package{pstricks}& \LC& \Package{pstcol}\\
458 % load before \XC & allowed & allowed & allowed\rlap{\footnotemark[1]} & no & no \\
459 % load with \XC{} option& \Option{table} & --- & --- & --- & --- \\
460 % load after \XC & allowed & allowed & allowed & no & no \\
461 % \hline\hline
462 % \multicolumn5{c}{\footnotemark[1]\,\Package{pstricks} loads \XC\ by default}\\
463 % \hline
464 % \end{tabular}
465 % \end{adjustwidth}
466 % \end{table}
467 %
468 %
469 % \begin{table}[htbp]\caption{Supported color models}\label{tab.mod}
470 % \raggedleft
471 % \extrarowheight2pt
472 % \rowcolors{3}{tablerowcolor}{}
473 % \begin{tabular}{l>{\em}l>{$}l<{$}rl}
474 % \hline
475 % \rowcolor{tableheadcolor}
476 % \emph{Name} & Base colors/notions & \emph{Parameter range}& \multicolumn2{>{\columncolor{tableheadcolor}}l}{\emph{Default}}\\
477 % \Model{rgb} & red, green, blue & \left[0,1\right]^3&& \\
478 % \Model{cmy} & cyan, magenta, yellow & \left[0,1\right]^3&& \\
479 % \Model{cmyk} & cyan, magenta, yellow, black & \left[0,1\right]^4&& \\
480 % \Model{hsb} & hue, saturation, brightness & \left[0,1\right]^3&& \\
481 % \Model{Hsb} & hue\Circ\!, saturation, brightness & \left[0,H\right]\times\left[0,1\right]^2&$H=$& $\mkern-15mu\rangeHsb$\\
482 % \Model{tHsb} & hue\Circ\!, saturation, brightness & \left[0,H\right]\times\left[0,1\right]^2&$H=$& $\mkern-15mu\rangeHsb$\\
483 % \Model{gray} & gray & \left[0,1\right]&& \\
484 % \Model{RGB} & Red, Green, Blue & \{0,1,\dots,L\}^3& $L\,=$& $\mkern-15mu\rangeRGB$\\
485 % \Model{HTML} & RRGGBB & \{\texttt{000000},\dots,\texttt{FFFFFF}\}&& \\
486 % \Model{HSB} & Hue, Saturation, Brightness & \{0,1,\dots,M\}^3& $M=$& $\mkern-15mu\rangeHSB$\\
487 % \Model{Gray} & Gray & \{0,1,\dots,N\}& $N\,=$& $\mkern-15mu\rangeGray$\\
488 % \Model{wave} & lambda \emph{(nm)}& \left[363,814\right]&& \\
489 % \hline\hline
490 % \multicolumn5{c}{$L,M,N$ are positive integers; $H$ is a positive real number}\\
491 % \hline
492 % \end{tabular}
493 % \end{table}
494 %
495 %
496 % \subsubsection{Executing additional initialisation commands}
497 %
498 % \DescribeMacro\xcolorcmd
499 % Here is a simple interface to pass commands that should be executed at the end of the \XCP{} (immediately before the initialising |\color{black}| is executed).
500 % Just say |\def\xcolorcmd|\marg{commands} at some point before \XC{} is loaded.
501 %
502 % Example: assuming that |a.tex| is a complete \LaTeX{} document, a command like
503 % `|latex \def\xcolorcmd{\colorlet{black}{red}}\input{a}|'
504 % at the console generates a file |a.dvi| with all occurrences of \Color{black} being replaced by \Color{red}, without the necessity to change the source file itself.
505 % (The exact spelling of the console command might vary across operating systems and \TeX{} distributions.)
506 %
507 %
508 %
509 % \subsection{Color models}
510 %
511 % \subsubsection{Supported color models}
512 %
513 % The list of supported color models and their parameter ranges is given in table \vref{tab.mod}.
514 % We emphasize that this color support is independent of the chosen driver.
515 %
516 % `Color model support' also means that it is possible to specify colors directly with their parameters, e.g., by saying |\textcolor[cmy]{0.7,0.5,0.3}{foo}| (\textcolor[cmy]{0.7,0.5,0.3}{foo}) or |\textcolor[HTML]{AFFE90}{foo}| (\textcolor[HTML]{AFFE90}{foo}).
517 %
518 % \paragraph{\Model{rgb}, \Model{cmyk}, \Model{hsb}, \Model{gray}}
519 % These are the models supported by \Index{PostScript} directly.
520 % We therefore refer to \cite{plrm} for a description of their properties and relations.
521 % There is a special command
522 % \DescribeMacro\adjustUCRBG
523 % to fine-tune the mechanisms of \emph{undercolor-removal} and \emph{black-generation} during conversion to the \Model{cmyk} model, see section \vref{sec.cmy2cmyk} for details.
524 %
525 % \paragraph{\Model{cmy}}
526 % This is mainly a model for intermediary calculation steps.
527 % With respect to that, it is a simple complement of \Model{rgb}.
528 % As far as visualisation is concerned, \Model{cmy} is treated as \Model{cmyk} with $k=0$.
529 %
530 % \paragraph{\Model{HTML}}
531 % This is a model derived from \Model{rgb} in order to enable input of color parameters from web pages or CSS files.
532 % Therefore, it is not really a color model of its own right, but rather a user interface for convenience.
533 % It is worth mentioning that \Model{HTML} accepts any combination of the characters |0|--|9|, |A|--|F|, |a|--|f|, as long as the string has a length of exactly 6~characters.
534 % However, outputs of conversions to \Model{HTML} will always consist of numbers and \emph{uppercase} letters.
535 %
536 % \paragraph{\Model{Hsb}, \Model{tHsb}}
537 % Firstly, \Model{Hsb} is a `user interface' model, mapping $\emph{hue}\in[0,1]$ onto $\emph{hue\Circ}\in[0,H]$, where $H$ is given by |\def\rangeHsb|\marg{H}.
538 % \DescribeMacro\rangeHsb
539 % Thus, if $H=360$, we can think of a circle or wheel to specify the \emph{hue\Circ} parameter.
540 % Secondly, \Model{Hsb} is the basis for \Model{tHsb}, also named \pModel{tuned} \Model{Hsb}, which enables the user to apply a piecewise linear transformation on \emph{hue\Circ} by shifting selected \emph{hue\Circ} values forward or backward on the circle.
541 % This transformation is defined by |\def\rangetHsb{|$x_1,y_1;x_2,y_2;\dots$|}|
542 % \DescribeMacro\rangetHsb
543 % which specifies that $\emph{hue\Circ}=x_1$ in \Model{tHsb} means $\emph{hue\Circ}=y_1$ in \Model{Hsb}, etc.
544 % For example, \Color{yellow} is at 60\Circ{} in the \Model{Hsb} circle (\Color{red} being at 0\Circ), however, in most color wheels used by artists, \Color{yellow} is at 120\Circ.
545 % Therefore, a `|120,60|' entry would make sense if we planned to replicate an artist's color wheel via \Model{tHsb}.
546 % See section \vref{sec.tHsb2Hsb} for the exact transformation formula and further restrictions, and section \vref{sec.harmony} for color wheels and color harmonies.
547 % Figure \vref{fig.tHsb} may serve for comparison purposes.
548 %
549 % Example: `|\def\rangetHsb{|\texttt{\rangetHsb}|}|' is in fact \XC's default setting.
550 %
551 % \paragraph{\Model{wave}}
552 % With this model we try to make wavelengths transformable to standard color models, in order to approximate the visual appearance of light waves.
553 % While the visible spectrum covers a range of approximately 400--750\,nm, the implementation in \XC{} generally allows for all real `wavelengths' $\lambda$ that have an absolute value less than \csname strip@pt\endcsname\maxdimen{} (the biggest number \TeX{} can represent as a dimension).
554 % However, the probability of getting any non-black color outside the range of $\lambda\in[363,814]$ is exactly zero.
555 % Therefore, figure \vref{fig.spectrum} illustrates only the mentioned wavelength interval.
556 % Note that it is not possible to convert other models to \Model{wave} in a sensible way, since the latter covers only a limited range of colors.
557 %
558 % \paragraph{\Model{RGB}, \Model{HSB}, \Model{Gray}}
559 % These are derived models, turning the continuous $[0,1]$ parameter ranges of \Model{rgb}, \Model{hsb}, and \Model{gray} to finite sets of integers; we therefore use the term \emph{integer models}.
560 % The constants $L, M, N$ of table \ref{tab.mod} are defined via the commands |\def\rangeRGB|\marg{L},
561 % \DescribeMacro\rangeRGB
562 % |\def\rangeHSB|\marg{M},
563 % \DescribeMacro\rangeHSB
564 % and |\def\rangeGray|\marg{N}.
565 % \DescribeMacro\rangeGray
566 % Changes of these constants can be done \emph{before} or \emph{after} the \XCP{} is loaded, e.g.,
567 % \label{ex.range}\begin{verbatim}
568 % \documentclass{article}
569 % ...
570 % \def\rangeRGB{15}
571 % \usepackage[dvips]{xcolor}
572 % ...
573 % \GetGinDriver
574 % \usepackage[\GinDriver]{hyperref}
575 % ...
576 % \begin{document}
577 % ...
578 % \def\rangeRGB{63}
579 % ...
580 % \end{verbatim}
581 %
582 %
583 % \subsubsection{Substituting individual color models}\label{sec.subst}
584 %
585 % \DescribeMacro\substitutecolormodel
586 % \marg{source model}\marg{target model-list}\\
587 % Substitute \Meta{source model} by the first actually present model that occurs in \Meta{target model-list}.
588 % Only color models of type \Meta{num model} are allowed;
589 % all changes are local to the current group, but a prepended |\xglobal| is obeyed.
590 %
591 % Example: assume the actual driver has an incorrect implementation of \Model{hsb} whereas \Model{rgb} looks well.
592 % Then |\substitutecolormodel{hsb}{rgb}| could be a good choice, since it converts --- from that point onwards --- all definitions of \Model{hsb} colors by \XC's algorithms into \Model{rgb} specifications, without touching other models.
593 %
594 %
595 % \subsubsection{Changing the target color model within a document}\label{sec.tgt}
596 %
597 % \DescribeMacro\selectcolormodel
598 % \marg{num model}\\
599 % Sets the target model to \Meta{num model}, where the latter is one of the model names allowed as package option (i.e., \Option{natural}, \Option{rgb}, \Option{cmy}, \Option{cmyk}, \Option{hsb}, \Option{gray}, \Option{RGB}, \Option{HTML}, \Option{HSB}, \Option{Gray}), see figure \vref{fig.tgt} for an example.
600 % There are two possible hooks, where the conversion to the target model can take place:
601 % \begin{itemize}
602 % \item \DescribeMacro\ifconvertcolorsD at color \emph{definition} time\footnote{This means that all \emph{newly} defined colors will be first converted to the target model, then saved.} (i.e., within |\definecolor| and friends); this is controlled by the switch |\ifconvertcolorsD|;
603 % \item \DescribeMacro\ifconvertcolorsU at time of color \emph{usage} (immediately before a color is displayed, therefore covering colors that have been defined in other models or that are being specified directly like |\color[rgb]{.1,.2,.3}|); this is controlled by the switch |\ifconvertcolorsU|.
604 % \end{itemize}
605 % Both switches are set to `true' by selecting any of the models, except \Option{natural}, which sets them to `false'.
606 % This applies for selection via a package option as well as via |\selectcolormodel|.
607 % Why don't we simply convert all colors at time of usage?
608 % If many colors are involved, it can save some processing time when all conversions are already done during color definitions.
609 % Best performance can be achieved by |\usepackage[rgb,...]{xcolor}\convertcolorsUfalse|, which is actually the way how \XC{} worked up to version 1.07.
610 %
611 %
612 % \begin{table}[p]\caption{Arguments and terminology}\label{tab.term}
613 % \def\RS{\ensuremath{\to}\space}
614 % \footnotesize\raggedleft
615 % \extrarowheight2pt
616 % \begin{adjustwidth}{-2.5cm}{}
617 % \advance\textwidth2.5cm
618 % \tabcolsep.25em
619 % \rowcolors{3}{tablerowcolor}{}
620 % \begin{tabularx}{\textwidth}{lX}
621 % \hline
622 % \rowcolor{tableheadcolor}
623 % \em Element & \em Replacement string\\
624 % \Meta*{empty}& \RS empty string `'\\
625 % \Meta*{minus}& \RS non-empty string consisting of one or more minus signs `|-|'\\
626 % \Meta*{plus}& \RS non-empty string consisting of one or more plus signs `|+|'\\
627 % \hline
628 % \Meta*{int}& \RS integer number\hfill(\emph{integer})\\
629 % \Meta*{num}& \RS non-negative integer number\hfill(\emph{number})\\
630 % \Meta*{dec}& \RS real number\hfill(\emph{decimal})\\
631 % \Meta*{div}& \RS non-zero real number\hfill(\emph{divisor})\\
632 % \Meta*{pct}& \RS real number from the interval $[0,100]$\hfill(\emph{percentage})\\
633 % \hline
634 % \Meta*{id}& \RS non-empty string consisting of letters and digits\hfill(\emph{identifier})\\
635 % \Meta*{ext id}& \RS \Meta{id}\newline
636 % \RS \Meta[1]{id}|=|\Meta[2]{id}\\
637 % \Meta*{id-list}& \RS \Meta[1]{ext id}|,|\Meta[2]{ext id}|,...,|\Meta[l]{ext id}\\
638 % \Meta*{name}& \RS \Meta{id}\hfill(\emph{explicit name})\newline
639 % \RS `|.|'\hfill(\emph{implicit name})\\
640 % \Meta*{core model}& \RS `|rgb|', `|cmy|', `|cmyk|', `|hsb|', `|gray|'\hfill(\emph{core models})\\
641 % \Meta*{num model}& \RS \Meta{core model}\newline
642 % \RS `|RGB|', `|HTML|', `|HSB|', `|Gray|'\hfill(\emph{integer models})\newline
643 % \RS `|Hsb|', `|tHsb|', `|wave|'\hfill(\emph{decimal models})\\
644 % \Meta*{model}& \RS \Meta{num model}\hfill(\emph{numerical models})\newline
645 % \RS `|named|'\hfill(\emph{pseudo model})\\
646 % \Meta*{model-list}& \RS \Meta[1]{model}|/|\Meta[2]{model}|/.../|\Meta[m]{model} \hfill(\emph{multiple models})\newline
647 % \RS \Meta{core model}|:|\Meta[1]{model}|/|\Meta[2]{model}|/.../|\Meta[m]{model}\\
648 % \Meta*{spec}& \RS comma-separated list of numerical values\hfill(\emph{explicit specification})\newline
649 % \RS space-separated list of numerical values\hfill(\emph{explicit specification})\newline
650 % \RS name of a `named' color\hfill(\emph{implicit specification})\\
651 % \Meta*{spec-list}& \RS \Meta[1]{spec}|/|\Meta[2]{spec}|/.../|\Meta[m]{spec} \hfill(\emph{multiple specifications})\\
652 % \Meta*{type}& \RS \Meta{empty}\newline
653 % \RS `|named|', `|ps|'\\
654 % \hline
655 % \Meta*{expr}& \RS \Meta{prefix}\Meta{name}\Meta{mix expr}\Meta{postfix}\hfill(\emph{standard color expression})\\
656 % \Meta*{prefix}& \RS \Meta{empty}\newline
657 % \RS \Meta{minus}\hfill(\emph{complement indicator})\\
658 % \Meta*{mix expr}& \RS |!|\Meta[1]{pct}|!|\Meta[1]{name}|!|\Meta[2]{pct}|!|\Meta[2]{name}|!...!|\Meta[n]{pct}|!|\Meta[n]{name} \hfill(\emph{complete mix expr.})\newline
659 % \RS |!|\Meta[1]{pct}|!|\Meta[1]{name}|!|\Meta[2]{pct}|!|\Meta[2]{name}|!...!|\Meta[n]{pct} \hfill(\emph{incomplete mix expr.})\\
660 % \Meta*{postfix}& \RS \Meta{empty}\newline
661 % \RS |!!|\Meta{plus}\hfill(\emph{series step})\newline
662 % \RS |!![|\Meta{num}|]|\hfill(\emph{series access})\\
663 % \hline
664 % \Meta*{ext expr}& \RS \Meta{core model}|,|\Meta{div}|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|,|\Meta[k]{dec}\newline
665 % \RS \Meta{core model}|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|,|\Meta[k]{dec}\\
666 % \hline
667 % \Meta*{func expr}& \RS |>|\Meta{function}|,|\Meta[1]{arg}|,|\Meta[2]{arg}|,...,|\Meta[j]{arg}\hfill(\emph{color function expression})\\
668 % \Meta*{function}& \RS `|wheel|', `|twheel|'\hfill(\emph{color functions})\\
669 % \hline
670 % \Meta*{color}& \RS \Meta{color expr}\Meta[1]{func expr}\Meta[2]{func expr}|...|\Meta[i]{func expr}\\
671 % \Meta*{color expr}& \RS \Meta{name}\newline
672 % \RS \Meta{expr}\newline
673 % \RS \Meta{ext expr}\\
674 % \hline\hline
675 % \rowcolor{white}
676 % Remarks:& Each \RS denotes a possible replacement string for the element in the left column;
677 % however, further context-dependent restrictions may apply.
678 % See main text for details.
679 % A string `|foo|' is always to be understood without the quotes.
680 % $i,j,k,l,m,n$ denote non-negative integers, $k,l,m,n>0$, $m\le8$.\\
681 % \hline
682 % \end{tabularx}
683 % \end{adjustwidth}
684 % \end{table}
685 %
686 %
687 %
688 % \subsection{Arguments and terminology}\label{sec.term}
689 %
690 % Before we describe \XC's color-related commands in detail, we define several elements or identifiers that appear repeatedly within arguments of those commands.
691 % A general syntax overview is given in table \vref{tab.term}.
692 %
693 %
694 % \subsubsection{Additional remarks and restrictions on arguments}
695 %
696 % \paragraph{Basic strings and numbers}
697 % \DescribeArg{empty}
698 % \DescribeArg{minus}
699 % \DescribeArg{plus}
700 % \DescribeArg{int}
701 % \DescribeArg{num}
702 % \DescribeArg{dec}
703 % \DescribeArg{pct}
704 % \DescribeArg{div}
705 % These arguments do not need much explanation.
706 % However, as far as numerical values are concerned, it is noteworthy that real numbers in (La)\TeX{} are --- as long as they are to be used in the context of lengths, dimensions, or skips --- are restricted to a maximum absolute value $<16384$.
707 % Certainly, in a chain of numerical calculations, this constraint has also to be obeyed for every single interim result, which usually implies further range restrictions.
708 % Since \XC{} makes extensive use of \TeX's internal dimension registers for most types of calculations, this should be kept in mind whenever \Meta{ext expr} expressions are to be used.
709 %
710 %
711 % \paragraph{Color names}
712 % \DescribeArg{name}
713 % A \Meta{name} denotes the declared name (or the name to be declared) of a \emph{color} or a \emph{color series};
714 % it may be declared \emph{explicitly} by one of the following commands: |\definecolor|, |\providecolor|, |\colorlet|, |\definecolorset|, |\providecolorset|, |\definecolorseries|, |\definecolors|, |\providecolors|.
715 % On the other hand, the reserved color name `|.|' is declared \emph{implicitly} and denotes the \emph{current color}.
716 % Actually, besides letters and digits, certain other characters do also work for \Meta{name} declarations, but the given restriction avoids misunderstandings and ensures compatibility with future extensions of \XC.
717 %
718 % Examples: `|red|', `|MySpecialGreen1980|', `|.|'.
719 %
720 %
721 % \paragraph{Color models}
722 % \DescribeArg{core model}
723 % \DescribeArg{num model}
724 % \DescribeArg{model}
725 % The differentiation between \emph{core models} (\Model{rgb}, \Model{cmy}, \Model{cmyk}, \Model{hsb}, \Model{gray}), \emph{integer models} (\Model{RGB}, \Model{HTML}, \Model{HSB}, \Model{Gray}), \emph{decimal models} (\Model{Hsb}, \Model{tHsb}, \Model{wave}) and \emph{pseudo models} (currently \nModel{named}, \nModel{ps}) has a simple reason: core models with their parameter ranges based on the unit interval $[0,1]$ are best suited for all kinds of calculations, whereas the purpose of the integer models is mainly to facilitate the input of parameters, followed by some transformation into one of the core models.
726 % Finally, the decimal models \Model{Hsb} and \Model{tHsb} are special-purpose versions of \Model{hsb}, whereas \Model{wave} and the pseudo model \nModel{named} have a special status, since they are `calculation-averse': it is usually only possible to convert such a color into one of the other models, but not the other way round.
727 % Even worse for the pseudo model \nModel{ps}: since such colors contain \Index{PostScript} code, they are absolutely intransparent for \TeX.
728 %
729 %
730 % \paragraph{Color specifications}
731 % \DescribeArg{spec}
732 % The \Meta{spec} argument --- which specifies the parameters of a color --- obviously depends on the underlying color model.
733 % We differentiate between \emph{explicit} and \emph{implicit} specification, the former referring to numerical parameters as explained in table \vref{tab.mod}, the latter --- ideally --- referring to driver-provided names.
734 %
735 % Examples: `|.1,.2,.3|', `|.1 .2 .3|', `|0.56789|', `|89ABCD|', `|ForestGreen|'.
736 %
737 %
738 % \paragraph{Multiple models and specifications}
739 % \DescribeArg{model-list}
740 % \DescribeArg{spec-list}
741 % These arguments always appear in (explicit or implicit) pairs within the following color definition commands:
742 % |\definecolor|, |\providecolor|, |\definecolorset|, |\providecolorset|.
743 % First, \Meta{model-spec} is being reconciled with the current target model (as set by a package option or the |\selectcolormodel| command); in case there is no exact match, the first model of the list is chosen.
744 % Then, the corresponding color specification will be selected from \Meta{spec-list}, such that we arrive at a proper $(\Meta{model}, \Meta{spec})$ pair.
745 % Therefore, in the actual executed color definition there is no ambiguity anymore.
746 % The extended form \Meta{core model}|:|\Meta[1]{model}|/|\Meta[2]{model}|/.../|\Meta[m]{model} causes an immediate conversion of the relevant \Meta{spec} to \Meta{core model}; an unknown target model will be silently ignored here.
747 %
748 % Examples: `|rgb/cmyk/named/gray|', `|0,0,0/0,0,0,1/Black/0|', `|rgb:cmy/hsb|'.
749 %
750 %
751 % \paragraph{The type argument}
752 % \DescribeArg{type}
753 % This is used only in the context of color defining commands, see the description of |\definecolor| and friends.
754 %
755 %
756 % \paragraph{Standard color expressions}
757 % \DescribeArg{expr}
758 % \DescribeArg{prefix}
759 % \DescribeArg{mix expr}
760 % \DescribeArg{postfix}
761 % These expressions serve as a tool to easily specify a certain form of cascaded color mixing which is described in detail in section~\ref{sec.expr-meaning}.
762 % The \Meta{prefix} argument controls whether the color following thereafter or its complement will be relevant:
763 % an odd number of minus signs indicates that the color resulting from the remaining expression has to be converted into its complementary color.
764 % An \emph{incomplete mix expression} is just an abbreviation for a \emph{complete mix expression} with $\Meta[n]{name} = |white|$, in order to save some keystrokes in the case of tints.
765 % The \Meta{postfix} string is usually empty, but it offers some additional functionality in the case of a \emph{color series}:
766 % the non-empty cases require that
767 % \begin{itemize}
768 % \item \Meta{name} denotes the name of a \emph{color series},
769 % \item \Meta{mix expr} is a \emph{complete} mix expression.
770 % \end{itemize}
771 % Examples: `|red|', `|-red|', `|--red!50!green!12.345|', `|red!50!green!20!blue|', `|foo!!+|', `|foo!![7]|', `|foo!25!red!!+++|', `|foo!25!red!70!green!![7]|'.
772 %
773 %
774 % \paragraph{Extended color expressions}
775 % \DescribeArg{ext expr}
776 % These expressions provide another method of color mixing, see section \vref{sec.extexpr-meaning} for details.
777 % The shorter form
778 % \begin{align*}
779 % \Meta{core model}&|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|!|\Meta[k]{dec}\\
780 % \intertext{is an abbreviation for the special (and probably most used) case}
781 % \Meta{core model}|,|\Meta{div}&|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|!|\Meta[k]{dec}\\
782 % \intertext{with the following definition (requiring a non-zero sum of all \Meta[\kappa]{dec} coefficients):}
783 % \Meta{div} &:= \Meta[1]{dec} + \Meta[2]{dec} + \dots + \Meta[k]{dec} \neq0.
784 % \end{align*}
785 % Examples: `|rgb:red,1|', `|cmyk:red,1;-green!25!blue!60,11.25;blue,-2|'.
786 %
787 %
788 % \paragraph{Function expressions}
789 % \DescribeArg{func expression}
790 % \DescribeArg{function}
791 % These expressions extend the functionality of \emph{standard} or \emph{extended} expressions by taking the result of such an expression to perform additional calculations.
792 % The number of arguments may vary between different functions, see section \vref{sec.functions} for details.
793 %
794 % Examples: `|>wheel,30|', `|>wheel,30,|', `|>twheel,1,12|', `|>twheel,-11,12|'.
795 %
796 %
797 %
798 % \paragraph{Colors}
799 % \DescribeArg{color}
800 % \DescribeArg{color expr}
801 % Finally, \Meta{color} is the `umbrella' argument, covering the different concepts of specifying colors.
802 % This means, whenever there is a \Meta{color} argument, the full range of names and expressions, as explained above, may be used.
803 %
804 %
805 % \subsubsection{Meaning of standard color expressions}\label{sec.expr-meaning}
806 %
807 % We explain now how an expression
808 % \begin{gather*}
809 % \Meta{prefix}\Meta{name}|!|\Meta[1]{pct}|!|\Meta[1]{name}|!|\Meta[2]{pct}|!|\dots|!|\Meta[n]{pct}|!|\Meta[n]{name}\Meta{postfix}
810 % \end{gather*}
811 % is being interpreted and processed:
812 % \begin{enumerate}
813 % \item First of all, the model and color parameters of \Meta{name} are extracted to define a temporary color \Meta{temp}.
814 % If \Meta{postfix} has the form `|!![|\Meta{num}|]|', then \Meta{temp} will be the corresponding (direct-accessed) color \Meta{num} from the series \Meta{name}.
815 % \item Then a color mix, consisting of \Meta[1]{pct}\% of color \Meta{temp} and $(100-\Meta[1]{pct})$\% of color \Meta[1]{name} is computed; this is the new temporary color \Meta{temp}.
816 % \item The previous step is being repeated for all remaining parameter pairs (\Meta[2]{pct},\Meta[2]{name}), \dots, (\Meta[n]{pct},\Meta[n]{name}).
817 % \item If \Meta{prefix} consists of an odd number of minus signs `-', then \Meta{temp} will be changed into its complementary color.
818 % \item If \Meta{postfix} has the form `|!!+|', `|!!++|', `|!!+++|', etc., a number of step commands (=~number of `|+|' signs) are performed on the underlying color series \Meta{name}.
819 % This has no consequences for the color \Meta{temp}.
820 % \item Now the color \Meta{temp} is being displayed or serves as an input for other operations, depending on the invoking command.
821 % \end{enumerate}
822 % Note that in a typical step 2 expression \Meta{temp}|!|\Meta[\nu]{pct}|!|\Meta[\nu]{name}, if \Meta[\nu]{pct}=100 resp.{} \Meta[\nu]{pct}=0, the color \Meta{temp} resp.{} \Meta[\nu]{name} is used without further transformations.
823 % In the true mix case, $0<$\Meta[\nu]{pct}$<100$, the two involved colors may have been defined in different color models, e.g., |\definecolor{foo}{rgb}{...}| and |\definecolor{bar}{cmyk}{...}|.
824 % In general, the second color, \Meta[\nu]{name}, is transformed into the model of the first color, \Meta{temp}, then the mix is calculated within that model.\,\footnote{Exception: in order to avoid strange results, this rule is being reversed if \Meta{temp} origins from the \Model{gray} model; in this case it is converted into the underlying model of \Meta[\nu]{name}.}
825 % Thus, \Meta{temp}|!|\Meta[\nu]{pct}|!|\Meta[\nu]{name} and \Meta[\nu]{name}|!|\Meta[\nu]{$100-$pct}|!|\Meta{temp}, which should be equivalent theoretically, will not necessarily yield identical visual results.
826 %
827 % Figures \vrefrange{fig.expr}{fig.ex} show some first applications of colors and expressions.
828 % More examples are given in figure \vref{fig.progress}.
829 % Over and above that, a large set of color examples can be found in \cite{chroma}.
830 %
831 %
832 % \subsubsection{Meaning of extended color expressions}\label{sec.extexpr-meaning}
833 %
834 % An \emph{extended color expression}
835 % \begin{gather*}
836 % \Meta{core model}|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|,|\Meta[k]{dec}
837 % \end{gather*}
838 % mimes color mixing as painters do it: specify a list of colors, each with a \Meta{dec} factor attached to.
839 % For such an \Meta{ext expr}, each standard color expression \Meta[\kappa]{expr} will be converted to \Meta{core model}, then the resulting vector is multiplied by $\Meta[\kappa]{dec}/\Meta{div}$, where
840 % \begin{gather*}
841 % \Meta{div} := \Meta[1]{dec} + \Meta[2]{dec} + \dots + \Meta[k]{dec}.
842 % \end{gather*}
843 % Afterwards the sum of all of these vectors is calculated.
844 %
845 % Example: mixing 4~parts of \testclr{red} \Color{red}, 2~parts of \testclr{green} \Color{green}, and 1~part of \testclr{yellow} \Color{yellow}, we get \testclr{rgb:red,4;green,2;yellow,1} via |\color{rgb:red,4;green,2;yellow,1}|.
846 % Trying the same with $-1$ parts of \Color{yellow} instead, we get \testclr{rgb:red,4;green,2;yellow,-1}.
847 % Note that this mechanism can also be used to display an individual color (expression) in a certain color model: |\color{rgb:yellow,1}| results in such a conversion.
848 % The general form
849 % \begin{gather*}
850 % \Meta{core model}|,|\Meta{div}|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|,|\Meta[k]{dec}
851 % \end{gather*}
852 % does the same operation with the only difference that the divisor \Meta{div} is being specified instead of calculated.
853 % In the above example, we get a shaded version \testclr{rgb,9:red,4;green,2;yellow,1} via |\color{rgb,9:red,4;green,2;yellow,1}|.
854 % Note that it is not forbidden to specify a \Meta{div} argument which is smaller than the sum of all \Meta[\kappa]{dec}, such that one or more of the final color specification parameters could be outside the interval $[0,1]$.
855 % However, the mapping of equation (\ref{eq.U}) takes care of such cases.
856 %
857 %
858 % \subsubsection{Color functions}\label{sec.functions}
859 %
860 % Color functions take a comma-separated list of arguments, and they serve to transform the \emph{given color} (i.e., the result of all calculations prior to the function call) into a new color.
861 %
862 % \paragraph{Color wheel calculations}
863 % \DescribeFunc{wheel}
864 % \DescribeFunc{twheel}
865 % Arguments: \Meta{angle} or \Meta{angle}|,|\Meta{full circle}, the former being an abbreviataion of \Meta{angle}|,\rangeHsb|.
866 % These functions allow to calculate related colors by harmonic relations based on color wheels (cf.~section \vref{sec.harmony}).
867 % The second argument \Meta{full circle} declares how many units a full circle consists of, the first argument states by how many units the given color has to be rotated.
868 % To this end, the given color is first converted to \Model{Hsb} (in case of \Function{wheel}), yielding \emph{hue\Circ}, \emph{saturation}, and \emph{brightness}, respectively.
869 % Then
870 % \begin{gather}
871 % \displaystyle\emph{hue\Circ} := \emph{hue\Circ} + \frac{\Meta{angle}}{\Meta{full circle}}\cdot H, \qquad \emph{hue} := u\Bigl( \frac{\emph{hue\Circ}}{H} \Bigr)
872 % \end{gather}
873 % where $u$ is the range-reduction function of equation~(\ref{eq.U}) and $H = \texttt{\string\rangeHsb}$.
874 % With \emph{saturation} and \emph{brightness} left untouched, the final model is \Model{hsb}.
875 % The \Function{twheel} function works similarly, but its arguments refer to \Model{tHsb} instead of \Model{Hsb}.
876 % Examples are shown in figure \vref{fig.harmony}.
877 %
878 %
879 % \subsection{Predefined colors}
880 %
881 % \subsubsection{Colors that are always available}
882 %
883 % \def\test#1{\testclr{#1}~\Color{#1}}
884 % Within \File{xcolor.sty}, the following color names are defined:
885 % \test{red}, \test{green}, \test{blue}, \test{cyan}, \test{magenta}, \test{yellow}, \test{black}, \test{gray}, \test{white}, \test{darkgray}, \test{lightgray}, \test{brown}, \test{lime}, \test{olive}, \test{orange}, \test{pink}, \test{purple}, \test{teal}, \test{violet}.
886 %
887 % This base set of colors can be used without restrictions in all kinds of color expressions, as explained in section \vref{sec.term}.
888 %
889 %
890 % \subsubsection{Additional sets of colors}\label{sec.additionalcolors}
891 %
892 % There are also sets of color names that may be loaded by \XC{} via package options, available in two variants:
893 % a `normal' version (e.g., \Option{dvipsnames}) and a `starred' version (e.g., \Option{dvipsnames*}).
894 % The first variant simply defines all the colors \emph{immediately}, whereas the second applies the mechanism of \emph{deferred} definition.
895 % In the latter case, individual color names have to be activated by |\definecolors| or |\providecolors| commands, as described in section \vref{sec.deferred}, before they can be applied in a document.
896 % \begin{itemize}
897 % \item \Option{dvipsnames}/\Option{dvipsnames*} loads a set of 68 \Model{cmyk} colors as defined in the |dvips| driver. However, these colors may be used in all supported drivers.
898 % \item \Option{svgnames}/\Option{svgnames*} loads a set of 151 \Model{rgb} color names\footnote{In fact, these names represent 141 different colors.} according to the \Index{SVG}~1.1 specification \cite{svg}\footnote{Actually, the cited specification lists only lowercase names, and the original definitions are given in \Model{RGB} parameters, converted to \Model{rgb} by the author.}, enhanced by~4 names taken from the file \File{rgb.txt} which is part of \Index{Unix}/\Index{X11} distributions. Note that \Index{HTML4} accepts a subset of 16~color keywords (using identical specifications), see \cite{HTML4} and section \vref{sec.names}.
899 % \item \Option{x11names}/\Option{x11names*} loads a set of 317 \Model{rgb} color names\footnote{These names represent 315 different colors.} that are basically variations of a subset of the \Index{SVG} set mentioned before, according to the file \File{rgb.txt} which is part of \Index{Unix}/\Index{X11} distributions\footnote{Again, the original definitions are given in \Model{RGB} parameters, converted to \Model{rgb} by the author.}.
900 % We describe now how to access all 752 color names of \File{rgb.txt} without much effort:
901 % \begin{itemize}
902 % \item Load \Option{x11names} as well as \Option{svgnames}.
903 % \item Capitalise initials and skip blanks: \Color[-]{DarkSlateGray} instead of \Color[-]{dark slate gray}.
904 % \item \Index{X11} names without numbers are identical to the corresponding \Index{SVG} colors, except in 5~cases:
905 % use \Color{Gray0}, \Color{Grey0}, \Color{Green0}, \Color{Maroon0}, \Color{Purple0} instead of \Color[-]{Gray}, \Color[-]{Grey}, \Color[-]{Green}, \Color[-]{Maroon}, \Color[-]{Purple} to obtain the original \Index{X11} colors.
906 % \item For $N=0,1,\dots,100$ use `|[gray]{|$N/100$|}|' or `|black!|$100-N$' instead of \Color[-]{grayN} or \Color[-]{greyN}.
907 % \end{itemize}
908 % \end{itemize}
909 % The color names and corresponding displays are listed in section \vref{sec.names}.
910 % Section \vref{sec.clash} describes how to deal with name clashs while using both \Option{svgnames} and \Option{dvipsnames} in the same document.
911 % See also \cite{chroma} for a systematic set of color and mix examples.
912 %
913 %
914 % \subsection{Color definition}\label{sec.def}
915 %
916 % \subsubsection{Ordinary and named colors}\label{sec.prologue}
917 %
918 % In the \LCP{} there is a distinction between `colors' (defined by the command |\definecolor|) and `named colors' (defined by |\DefineNamedColor|, which is allowed only in the preamble).
919 % Whenever an ordinary color is being used in a document, it will be translated into a |\special| command that contains a --- driver-specific --- numerical description of the color which is written to the \File{.dvi} file.
920 % On the other hand, named colors offer the opportunity to store numerical values at a central place whereas during usage, colors may be identified by their names, thus enabling post-processing if required by the output device.
921 %
922 % All drivers delivered with the standard \Package{graphics} package support the \emph{formalism} of defining and invoking `named colors'.
923 % However, real support for the \emph{concept} behind that, i.e.~employing names instead of parameters, ranges from `none' to `complete'.
924 % We demonstrate the current situation for three different drivers:
925 % \begin{itemize}
926 % \item \Option{dvips} has very good support for the `named' concept; the \Index{PostScript} equivalents to the color names defined by \Option{dvipsnames} are being loaded -- unless switched off -- by \Program{dvips} automatically.
927 % However, additional names have to be made known to the \Index{PostScript} interpreter by some kind of header file.
928 % Since version 2.01, \XC{} offers an integrated solution for this task: by invoking the package option \Option{prologue}, a \Index{PostScript} header file \File{xcolor.pro} is loaded by \Program{dvips}.
929 % Additionally, under this option every color definition command\footnote{This is not only true for the document preamble, but for the document body as well.} (|\definecolor|, |\colorlet|, etc.) will generate some \Index{PostScript} code that is written to an auxiliary file with the extension \File{.xcp} (shortcut for \textbf{xc}olor \textbf prologue).
930 % This file is as well loaded by \Program{dvips} as a prologue, thus making all color names available to the \Index{PostScript} interpreter.
931 % Of course, the \File{.xcp} file may be edited before \Program{dvips} is applied, making it easy to change device-specific color parameters at a central place.
932 % Note that the \Index{PostScript} code is designed similar to \File{color.pro}: only \emph{new} names are defined.
933 % This allows to preload other prologue files with color definitions that are not being destroyed by \XC.
934 % On the other hand, it requires the user to take care about redefining color names.\\
935 % Example: |\colorlet{foo}{red}\colorlet{foo}{blue}\color{foo}| will switch to \Color{blue} in the usual \XC{} logic, however the \File{.ps} file would display \Color{red} (unless \Color{foo} had been defined differently before).\\
936 % It should be stressed that this mechanism is only employed by the \Option{prologue} option.
937 % Without that, the predefined `named' colors activated by the \Option{dvipsnames} option (without employing any tints, shades, color expressions, etc.) may be used in this way, all other `named' colors are unknown to \Index{PostScript}.
938 % \item \Option{dvipdfm} supports only the standard \Option{dvipsnames} colors since these are hard-coded in the \Program{dvipdfm} program itself; there seems to be no way to load any user-defined prologue files.
939 % \item \Option{pdftex} does not offer conceptual support, all `named' colors are converted immediately to their numerical representation. It therefore allows unrestricted definition and usage of named colors (although offering no added value through this).
940 % \end{itemize}
941 %
942 % Typically, a \File{.dvi} viewer will have difficulties to display user-defined `named' colors.
943 % For example, \Index{MiK\TeX}'s viewer \Program{Yap} currently displays only `named' colors from the \Option{dvipsnames} set.
944 % Thus, whenever the \Option{prologue} option is invoked together with \Option{dvips}, \emph{all} other colors will appear black.
945 % However, after employing \Program{dvips}, a \Index{PostScript} viewer should display the correct colors.
946 %
947 %
948 % \subsubsection{Color definition in \XC}
949 %
950 % \DescribeMacro\definecolor
951 % \oarg{type}\marg{name}\marg{model-list}\marg{spec-list}\footnote{Prior to version 2.00, this command was called \cs{xdefinecolor}, the latter name still being available for compatibility reasons.}\\
952 % This is one of the commands that may be used to assign a \Meta{name} to a specific color.
953 % Afterwards, this color is known to the system (in the current group) and may be used in \emph{\Index{color expression}s}, as explained in section \vref{sec.term}.
954 % It replaces both \LC's |\DefineNamedColor| and |\definecolor|.
955 % Note that an already existing color \Meta{name} will be overwritten.
956 % The variable |\tracingcolors| controls whether such an overwriting will be logged or not (see section \vref{sec.info} for details).
957 % The arguments are described in section \vref{sec.term}.
958 % Hence, valid expressions for color definitions are
959 % \begin{itemize}
960 % \item |\definecolor{red}{rgb}{1,0,0}|,
961 % \item |\definecolor{red}{rgb/cmyk}{1,0,0/0,1,1,0}|,
962 % \item |\definecolor{red}{hsb:rgb/cmyk}{1,0,0/0,1,1,0}|,
963 % \item |\definecolor[named]{Black}{cmyk}{0,0,0,1}|,
964 % \item |\definecolor{myblack}{named}{Black}|,
965 % \end{itemize}
966 % where the last command is equivalent to |\colorlet{myblack}{Black}| (see below); the second command defines \Color{red} in the \Model{rgb} or \Model{cmyk} model, depending on the current setting of the \emph{target model}, whereas the third will additionally transform the color to \Model{hsb} prior to saving.
967 % Note that there is a special \Package{pstricks}-related version as described in section \vref{sec.pstricks}.
968 %
969 % \medskip
970 %
971 % \DescribeMacro\providecolor
972 % \oarg{type}\marg{name}\marg{model-list}\marg{spec-list}\\
973 % Similar to |\definecolor|, but the color \Meta{name} is only defined if it does not exist already.
974 %
975 % \medskip
976 %
977 % \DescribeMacro\colorlet
978 % \oarg{type}\marg{name}\oarg{num model}\marg{color}\\
979 % Copies the actual color which results from \Meta{color} to \Meta{name}.
980 % If \Meta{num model} is non-empty, \Meta{color} is first transformed to the specified model, before \Meta{name} is being defined.
981 % The pseudo model \nModel{named} is \emph{not} allowed here, it may, however, be specified in the \Meta{type} argument.
982 % Note that an already existing color \Meta{name} will be overwritten.
983 %
984 % Example: we said |\colorlet{tableheadcolor}{gray!25}| in the preamble of this document.
985 % In most of the tables we then formatted the first row by using the command |\rowcolor{tableheadcolor}|.
986 %
987 %
988 % \subsubsection{Defining sets of colors}
989 %
990 % \DescribeMacro\definecolorset
991 % \oarg{type}\marg{model-list}\marg{head}\marg{tail}\marg{set spec}\\
992 % This command facilitates the construction of \emph{\Index{color set}s}, i.e.~(possibly large) sets of individual colors with common underlying \Meta{model-list} and \Meta{type}.
993 % Here, \Meta{set spec} = \Meta[1]{name},\Meta[1]{spec-list};\dots;\Meta[l]{name},\Meta[l]{spec-list} ($l\ge1$ name/specification-list pairs).
994 % Individual colors are being constructed by single
995 % \begin{center}
996 % |\definecolor|\oarg{type}|{|\Meta{head}\Meta[\lambda]{name}\Meta{tail}|}|\marg{model-list}|{|\Meta[\lambda]{spec-list}|}|
997 % \end{center}
998 % commands, $\lambda=1,\dots,l$.
999 % For example,
1000 % \begin{itemize}
1001 % \item |\definecolorset{rgb}{}{}{red,1,0,0;green,0,1,0;blue,0,0,1}|\\
1002 % could be used to define the basic colors \Color{red}, \Color{green}, and \Color{blue};\footnote{Actually, \XC{} uses a more complicated variant to provide the basic colors for different underlying models (see the source code for the full command):\\
1003 % \cs{definecolorset\string{rgb/hsb/cmyk/gray\string}\string{\string}\string{\string}\string{red,1,0,0/0,1,1/0,1,1,0/.3;green,...\string}}.}
1004 % \item |\definecolorset{rgb}{x}{10}{red,1,0,0;green,0,1,0;blue,0,0,1}|\\
1005 % would define the colors \Color[-]{xred10}, \Color[-]{xgreen10}, and \Color[-]{xblue10}.
1006 % \end{itemize}
1007 %
1008 % \DescribeMacro\providecolorset
1009 % \oarg{type}\marg{model-list}\marg{head}\marg{tail}\marg{set spec}\\
1010 % Similar to |\definecolorset|, but based on |\providecolor|, thus the individual colors are defined only if they do not exist already.
1011 %
1012 %
1013 % \subsubsection{Immediate and deferred definitions}\label{sec.deferred}
1014 %
1015 % Traditionally, the definition of a color as described above leads to the immediate construction of a command that holds at least the information needed by the driver to display the desired color.
1016 % Thus, defining 300 colors, e.g., by loading a huge set of predefined colors, will result in 300 new commands, although most of them --- except for the purpose of displaying lists of colors --- will hardly ever be used within a document.
1017 % Along the development of computer memory --- increasing in size, decreasing in price --- recent \TeX{} implementations have increased their provisions for internal memory stacks that are available for strings, control sequences, etc.
1018 % However, as memory continues to be finite, it may still be useful (or occasionally necessary) to have a method at hand that allows to reduce memory requirements a bit.
1019 % This is the point where \emph{deferred color definition} comes into play.
1020 % Its principle is simple: for every definition of this type (e.g., via |\preparecolor|), all necessary information is saved on a specific global \emph{\Index{definition stack}}, where it can be taken from later (e.g., via |\definecolors|) in order to construct the actual color command.
1021 %
1022 % Note that the following commands are only to be used in the document preamble, since the definition stack of colors for deferred definitions is deleted at the begin of the document body --- in order to save memory.
1023 %
1024 % \medskip
1025 %
1026 % \DescribeMacro\preparecolor
1027 % \oarg{type}\marg{name}\marg{model-list}\marg{spec-list}\\
1028 % Similar to |\definecolor|, but the color \Meta{name} is not yet being defined: the arguments \Meta{model-list} and \Meta{spec-list} are evaluated immediately, then all necessary parameters (i.e.~\Meta{type}, \Meta{name}, \Meta{model}, \Meta{spec}) are put onto the \emph{\Index{definition stack}} for later usage.
1029 %
1030 % \medskip
1031 %
1032 % \DescribeMacro\preparecolorset
1033 % \oarg{type}\marg{model-list}\marg{head}\marg{tail}\marg{set spec}
1034 % \DescribeMacro\ifdefinecolors\\
1035 % Similar to |\definecolorset|, but depending on the |\ifdefinecolors| switch: if set to `true', to each element of the set the command |\definecolor| (i.e.~immediate definition) is applied; if set to `false', |\preparecolor| (i.e.~deferred definition) is applied.
1036 % For example, the package option \Option{svgnames} performs something like |\definecolorstrue\preparecolorset|, whereas \Option{svgnames*} acts like |\definecolorsfalse\preparecolorset|.
1037 % Both options set |\definecolorstrue| at the end, in order to have a proper starting point for other color sets.
1038 %
1039 % \medskip
1040 %
1041 % \DescribeMacro\DefineNamedColor
1042 % \marg{type}\marg{name}\marg{model-list}\marg{spec-list}
1043 % is provided mainly for compatibility reasons, especially to support the predefined colors in \File{dvipsnam.def}.
1044 % It is the same as \Meta{cmd}\oarg{type}\marg{name}\marg{model}\marg{spec}, where \Meta{cmd} is either |\definecolor| or |\preparecolor|, depending on the state of |\ifdefinecolors|.
1045 % Note that \LC's restriction to allow |\DefineNamedColor| only in the document preamble has been abolished in \XC.
1046 %
1047 % \medskip
1048 %
1049 % \DescribeMacro\definecolors
1050 % \marg{id-list}\\
1051 % Recall that \Meta{id-list} has the form \Meta[1]{ext id}|,...,|\Meta[l]{ext id} where each \Meta[\lambda]{ext id} is either an identifier \Meta[\lambda]{id} or an assignment \Meta[\lambda']{id}|=|\Meta[\lambda]{id}.
1052 % We consider the first case to be an abbreviation for \Meta[\lambda]{id}|=|\Meta[\lambda]{id} and describe the general case:
1053 % the \Index{definition stack} is searched for the name \Meta[\lambda]{id} and its corresponding color parameters; if there is no match, nothing happens; if the name \Meta[\lambda]{id} is on the stack and its color parameters are \Meta[\lambda]{type}, \Meta[\lambda]{model}, and \Meta[\lambda]{spec}, then the command |\definecolor[|\Meta[\lambda]{type}|]{|\Meta[\lambda']{id}|}{|\Meta[\lambda]{model}|}{|\Meta[\lambda]{spec}|}| is executed.
1054 % Thus, the user may control by which names the \emph{prepared} colors are to be used in the document.
1055 % Note that the entry \Meta[\lambda]{id} is not removed from the stack, such that it can be used several times (even within the same |\definecolors| command).
1056 %
1057 % \medskip
1058 %
1059 % \DescribeMacro\providecolors
1060 % \marg{id-list}\\
1061 % Similar to |\definecolors|, but based on |\providecolor|, thus the individual colors are defined only if they do not exist already.
1062 %
1063 %
1064 % \subsubsection{Global color definitions}
1065 %
1066 % \DescribeMacro\ifglobalcolors
1067 % By default, definitions via |\definecolor|, |\providecolor|, \dots{} are available only within the current group.
1068 % By setting |\globalcolorstrue|, all such definitions are being made globally available --- until the current group ends.\footnote{The switch may also be set in the preamble in order to control the whole document.}
1069 % \DescribeMacro\xglobal
1070 % Another method to specify that an individual color definition is to be made global is to prefix it by |\xglobal|, e.g., |\xglobal\definecolor{foo}...|.
1071 %
1072 %
1073 %
1074 % \subsection{Color application}
1075 %
1076 % \subsubsection{Standard color commands}
1077 %
1078 % Here is the list of user-level color commands, as known from the \LCP, but with an extended syntax for the colors, allowing for expressions etc.:\\
1079 % \DescribeMacro\color\marg{color}\\
1080 % \oarg{model-list}\marg{spec-list}\\
1081 % Switches to the color given either by name/expression or by model/specification.
1082 % This color will stay in effect until the end of the current \TeX\ group.\\
1083 % \DescribeMacro\textcolor\marg{color}\marg{text}\\
1084 % \oarg{model-list}\marg{spec-list}\marg{text}\\
1085 % are just alternative syntax for |\color|, in which the groups are added implicitly.
1086 % Thus \meta{text} appears in the specified color, but then the color reverts to its previous value.
1087 % Additionally, it calls |\leavevmode| to ensure the start of horizontal mode.\\
1088 % \DescribeMacro\pagecolor\marg{color}\\
1089 % \oarg{model-list}\marg{spec-list}\\
1090 % Specifies the background color for the current, and all following, pages.
1091 % It is a global declaration which does not respect \TeX\ groups.
1092 %
1093 % Remark: all of these commands except |\color| require that the \Meta{color} resp.\ \Meta{spec} arguments are put into curly braces |{}|, even if they are buried in macros.
1094 %
1095 % For example, after |\def\foo{red}|, one may say |\color\foo|, but one should always write |\textcolor{\foo}{bar}| instead of |\textcolor\foo{bar}| in order to avoid strange results.
1096 %
1097 % Note that color-specific commands from other packages may give unexpected results if directly confronted with color expressions (e.g., \Package{soul}'s |\sethlcolor| and friends).
1098 % However, one can turn the expression into a name via |\colorlet| and try to use that name instead.
1099 %
1100 % \DescribeMacro\nopagecolor
1101 % Removes any currently specified page color returning to the default transparent background.
1102 % It is not yet supported by all driver options and so generates a warning if there is no definition in the driver file.
1103 %
1104 %
1105 % \subsubsection{Colored boxes}\label{sec.fbox}
1106 %
1107 % \DescribeMacro\colorbox\marg{color}\marg{text}\\
1108 % \oarg{model-list}\marg{spec-list}\marg{text}\\
1109 % Takes the same argument forms as |\textcolor|, but the color specifies the \emph{background} color of the box.\\
1110 % \DescribeMacro\fcolorbox\marg{frame color}\marg{background color}\marg{text}\\
1111 % \oarg{model-list}\marg{frame spec-list}\marg{background spec-list}\marg{text}\\
1112 % \oarg{fr.~model-list}\marg{fr.~spec-list}\oarg{backgr.~model-list}\marg{backgr.~spec-list}\marg{text}\\
1113 % \marg{frame color}\oarg{background model-list}\marg{background spec-list}\marg{text}\\
1114 % Puts a frame of the first color around a box with a background specified by the second color.
1115 % If only the first optional argument is given, it specifies the color model for both colors.
1116 % Besides the possibility to specify color \emph{expressions} as arguments, |\fcolorbox| now offers more flexibility for its arguments than the \LC{} version:
1117 % \begin{itemize}
1118 % \item \fcolorbox{gray}{yellow}{test} |\fcolorbox{gray}{yellow}{test}|,
1119 % \item \fcolorbox[cmyk]{0,0,0,0.5}{0,0,1,0}{test} |\fcolorbox[cmyk]{0,0,0,0.5}{0,0,1,0}{test}|,
1120 % \item \fcolorbox[gray]{0.5}[wave]{580}{test} |\fcolorbox[gray]{0.5}[wave]{580}{test}|,
1121 % \item \fcolorbox{gray}[wave]{580}{test} |\fcolorbox{gray}[wave]{580}{test}|.
1122 % \end{itemize}
1123 % Additionally, |\fcolorbox| uses a new approach to frame drawing, which is an extension of \People{Donald}{Arseneau}'s suggestion in bug report latex/3655 \cite{fbox}.
1124 % The main difference to \LaTeX's implementation is that box construction and frame drawing are split into separate operations, such that the frame is drawn \emph{after} the box contents has been constructed.
1125 % This ensures that the frame is always on top of the box.
1126 % \People{Donald}{Arseneau} improved speed as well as memory requirements of this approach.
1127 % Furthermore, a new macro is introduced:
1128 %
1129 % \DescribeMacro\boxframe\marg{width}\marg{height}\marg{depth}\\
1130 % Draws a frame with a linewidth of |\fboxrule|.
1131 % Returns a |\hbox| with outer dimensions \meta{width}, \meta{height}, \meta{depth}.
1132 % By this approach, a frame-primitive may also be provided by a driver file, in order to exploit driver-specific drawing facilities (see below).
1133 % Again, this macro was optimised by \People{Donald}{Arseneau}.
1134 %
1135 % The new frame approach is used for |\fcolorbox| as well as \LaTeX's |\fbox| and |\framebox| commands, unless the \Option{kernelfbox} option is specified, which returns to \LaTeX's original definitions of |\f(rame)box|.
1136 %
1137 % Option \Option{xcdraw} uses \Index{PostScript} commands to draw frames and color boxes in case of the \Option{dvips} driver and \Index{PDF} code to draw frames in case of the \Option{pdftex} and \Option{dvipdfm} drivers.
1138 % This is still experimental code that may confuse \File{.dvi} viewers.
1139 % The opposite option \Option{noxcdraw} forces usage of the generic (driver-independent) code.
1140 %
1141 % \subsubsection{Colors in math}
1142 %
1143 % While it is possible to color parts of a formula using |\color| commands the approach is fairly cumbersome.
1144 % Therefore the command \cs{mathcolor} has been added to the \Package{color} and \Package{xcolor} package,
1145 % which has the same syntax as \cs{textcolor}. The full documentation and examples of its use is in \texttt{mathcolor.pdf}
1146 % in the \LaTeX{} documentation.
1147 %
1148 % \subsubsection{Using the current color}
1149 %
1150 % Within a color expression, `.' serves as a placeholder for the current color.
1151 % See figure \vref{fig.cc} for an example.
1152 %
1153 % It is also possible to save the current color for later use, e.g., via the command |\colorlet{foo}{.}|.
1154 %
1155 % Note that in some cases the current color is of rather limited use, e.g., the construction of an |\fcolorbox| implies that at the time when the \Meta{background color} is evaluated, the current color equals the \Meta{frame color}; in this case `|.|' does not refer to the current color \emph{outside} the box.
1156 %
1157 %
1158 % \subsubsection{Color testing}
1159 %
1160 % \DescribeEnv{testcolors}
1161 % \oarg{num models}\\
1162 % This is a simple tabular environment in order to test (display) colors in different models, showing both the visual result and the model-specific parameters.
1163 % The optional \Meta{num models} argument is a comma-separated list of \emph{numerical} color models (as usual without spaces) which form the table columns; the default list is
1164 % {\makeatletter\ttfamily\let\@protected@testopt\@gobbletwo\edef\tmp{\testcolors}\expandafter\@firstofone\tmp}.
1165 %
1166 % \DescribeMacro\testcolor
1167 % \marg{color}\\
1168 % \oarg{model-list}\marg{spec-list}\\
1169 % Each |\testcolor| command generates a table row, containing a display sample plus the respective parameters for each of the models.
1170 % If the column-model matches the model of the color in question, its parameters are underlined.
1171 % Note that this command is only available within the |testcolors| environment.
1172 %
1173 % For applications see figure \vref{fig.testcolors} and figures \ref{fig.tHsb}, \ref{fig.harmony}.
1174 %
1175 %
1176 %
1177 % \subsection{Color blending}
1178 %
1179 % The purpose of \emph{color blending} is to add some mixing color (expression) to all subsequent explicit color commands.
1180 % Thus, it is possible to perform such a mix (or blend) operation for many colors without touching the individual commands.
1181 %
1182 % \medskip
1183 %
1184 % \DescribeMacro\blendcolors
1185 % \marg{mix expr}\\
1186 % \DescribeMacro{\blendcolors*}
1187 % \marg{mix expr}\\
1188 % Initialises all necessary parameters for color blending.
1189 % The actual (completed) color blend expression is stored in |\colorblend|.
1190 % In the starred version, the argument will be appended to a previously defined blend expression.
1191 % An empty \Meta{mix expr} argument will switch blending off.
1192 %
1193 % Example: after |\blendcolors{!50!yellow}|, the colors \testclr{red} \testclr{green} \testclr{blue} are transformed into {\blendcolors{!50!yellow}\testclr{red} \testclr{green} \testclr{blue}, an additional |\blendcolors*{!50}| yields \blendcolors*{!50}\testclr{red} \testclr{green} \testclr{blue}}.
1194 % \DescribeMacro\xglobal
1195 % In order to achieve global scope, |\blendcolors| may be prefixed by |\xglobal|.
1196 %
1197 % Remark: color blending is applied only to \emph{explicit} color commands, i.e.~|\color|, |\fcolorbox| and the like.
1198 % In the previous example the frames are not being blended because their color is set by an driver-internal command (switching back to the `current color').
1199 % Thus, to influence these \emph{implicit} colors as well, we have to set the current color \emph{after} the blending:
1200 % |\blendcolors{!50!yellow}\color{black}| results in {\blendcolors{!50!yellow}\color{black}\testclr{red} \testclr{green} \testclr{blue}, an additional |\blendcolors*{!50}\color{black}| yields \blendcolors*{!50}\color{black}\testclr{red} \testclr{green} \testclr{blue}}.
1201 %
1202 %
1203 %
1204 % \subsection{Color masks and separation}
1205 %
1206 % The purpose of \emph{color separation} is to represent all colors that appear in the document as a combination of a finite subset of base colors and their tints.
1207 % Most prominent is \Model{cmyk} separation, where the base colors are \Color{cyan}, \Color{magenta}, \Color{yellow}, and \Color{black}, as required by the printers.
1208 % This can be done by choosing the package option \Option{cmyk}, such that all colors will be converted in this model, and post-processing the output file.
1209 % We describe now another --- and more general --- solution: \emph{color masking}.
1210 % How does it work?
1211 % Color masking is based on a specified color model \Meta{m-model} and a parameter vector \Meta{m-spec}.
1212 % Whenever a color is to be displayed in the document, it will first be converted to \Meta{m-model}, afterwards each component of the resulting color vector will be multiplied by the corresponding component of \Meta{m-spec}.
1213 % For example, let's assume that \Meta{m-model} equals |cmyk|, and \Meta{m-spec} equals $(\mu_c,\mu_m,\mu_y,\mu_k)$.
1214 % Then an arbitrary color \Color{foo} will be transformed according to
1215 % \begin{gather}
1216 % \Color{foo} \mapsto (c,m,y,k) \mapsto (\mu_c\cdot c,\mu_m\cdot m,\mu_y\cdot y,\mu_k\cdot k)
1217 % \end{gather}
1218 % Obviously, color separation is a special case of masking by the vectors $(1,0,0,0)$, $(0,1,0,0)$, etc.
1219 % An interesting application is to shade or tint all colors by masking them with $(x,x,x)$ in the \Model{rgb} or \Model{cmy} model, see the last two rows in figure \vref{fig.mask}.
1220 %
1221 % \medskip
1222 %
1223 % \DescribeMacro\maskcolors
1224 % \oarg{num model}\marg{color}\\
1225 % Initialises all necessary parameters for color masking:
1226 % if \Meta{num model} is not specified (or empty), \Meta{m-model} will be set to the natural model of \Meta{color}, otherwise to \Meta{num model};
1227 % the color specification of \Meta{color} is extracted to define \Meta{m-spec}.
1228 % Additionally, |\maskcolorstrue| is performed.
1229 % \DescribeMacro\ifmaskcolors
1230 % Color masking can be switched off temporarily by |\maskcolorsfalse|, or --- in a more radical way --- by |\maskcolors{}|, which in addition clears the initialisation parameters.
1231 % \DescribeMacro\xglobal
1232 % In general, the scope of |\maskcolors| is the current group (unless it is prefixed by the |\xglobal| command), but it may be used in the document preamble as well.
1233 % The final remark of the color blending section applies here similarly.
1234 %
1235 % Now it is easy to separate a complete document without touching the source code:
1236 % |latex| |\def\xcolorcmd{\maskcolors[cmyk]{cyan}}\input{a}| will do the \Color{cyan} part of the job for |a.tex|.
1237 %
1238 % \DescribeMacro\colormask
1239 % Caution: \XC{} has no idea about colors in files that are included via the command |\includegraphics|, e.g., images of type \File{.eps}, \File{.pdf}, \File{.jpg}, or \File{.png}.
1240 % Such files have to be separated separately.
1241 % Nevertheless, \XC{} offers some basic support by storing the mask color in |\colormask|, which can be used to decide which file is to be included:
1242 % \begin{verbatim}
1243 % \def\temp{cyan}\ifx\colormask\temp \includegraphics{foo_c}\else
1244 % \def\temp{magenta}\ifx\colormask\temp \includegraphics{foo_m}\else
1245 % ...
1246 % \fi\fi
1247 % \end{verbatim}
1248 %
1249 %
1250 %
1251 % \subsection{Color series}\label{sec.series}
1252 %
1253 % Automatic coloring may be useful in graphics or chart applications, where a --- potentially large and unspecified --- number of colors are needed, and the user does not want or is not able to specify each individual color.
1254 % Therefore, we introduce the term \emph{color series}, which consists of a base color and a scheme, how the next color is being constructed from the current color.
1255 %
1256 % The practical application consists of three parts:
1257 % definition of a color series (usually once in the document), initialisation of the series (potentially several times), and application --- with or without stepping --- of the current color of the series (potentially many times).
1258 %
1259 %
1260 % \subsubsection{Definition of a color series}
1261 %
1262 % \DescribeMacro\definecolorseries
1263 % \marg{name}\marg{core model}\marg{method}\oarg{b-model}\marg{b-spec}\oarg{s-model}\marg{s-spec}\\
1264 % Defines a color series called \Meta{name}, whose calculations are performed within the color model \Meta{core model}, where \Meta{method} selects the algorithm (one of |step|, |grad|, |last|, see below).
1265 % The method details are determined by the remaining arguments:
1266 % \begin{itemize}
1267 % \item \oarg{b-model}\marg{b-spec} specifies the \emph{base} (= first) color in the algorithm, either directly, e.g., |[rgb]{1,0.5,0.5}|, or as a \Meta{color}, e.g., |{-yellow!50}|, if the optional argument is missing.
1268 % \item \oarg{s-model}\marg{s-spec} specifies how the \emph{step} vector is calculated in the algorithm, according to the chosen \Meta{method}:
1269 % \begin{itemize}
1270 % \item |step|,\ |grad|:\ the optional argument is meaningless, and \Meta{s-spec} is a parameter vector whose dimension is determined by \Meta{core model}, e.g., |{0.1,-0.2,0.3}| in case of |rgb|, |cmy|, or |hsb|.
1271 % \item |last|:\ the last color is specified either directly, e.g., |[rgb]{1,0.5,0.5}|, or as a \Meta{color}, e.g., |{-yellow!50}|, if the optional argument is missing.
1272 % \end{itemize}
1273 % \end{itemize}
1274 % This is the general scheme:
1275 % \begin{gather}
1276 % \emph{color}_1 := \emph{base},\qquad
1277 % \emph{color}_{n+1} := U\bigl(\emph{color}_{n} + \emph{step}\bigr)
1278 % \end{gather}
1279 % for $n=1,2,\dots$, where $U$ maps arbitrary real $m$-vectors into the unit $m$-cube:
1280 % \begin{gather}
1281 % U(x_1,\dots,x_m) = (u(x_1),\dots,u(x_m)),\qquad
1282 % u(x) =
1283 % \begin{cases}
1284 % 1 & \text{if $x=1$}\\
1285 % x-[x]& \text{if $x\neq1$}\\
1286 % \end{cases}\label{eq.U}
1287 % \end{gather}
1288 % Thus, every step of the algorithm yields a valid color with parameters from the interval $[0,1]$.
1289 %
1290 % \medskip
1291 % Now, the different methods use different schemes to calculate the \emph{step} vector:
1292 % \begin{itemize}
1293 % \item |step|,\ |grad|:\ the last argument, \marg{s-spec}, defines the directional vector \emph{grad}.
1294 % \item |last|:\ \marg{s-spec} resp.\ \oarg{s-model}\marg{s-spec} defines the color parameter vector \emph{last}.
1295 % \end{itemize}
1296 % Then, during |\resetcolorseries|, the actual \emph{step} vector is calculated:
1297 % \begin{gather}
1298 % \emph{step} :=
1299 % \begin{cases}
1300 % \emph{grad} & \text{if $\Meta{method} = |step|$}\\
1301 % \frac1{\Meta{div}}\cdot\emph{grad} & \text{if $\Meta{method} = |grad|$}\\
1302 % \frac1{\Meta{div}}\cdot(\emph{last}-\emph{base}) & \text{if $\Meta{method} = |last|$}\\
1303 % \end{cases}\label{eq.cs}
1304 % \end{gather}
1305 % Please note that it is also possible to use the current color placeholder `.' within the definition of color series.
1306 % Thus, |\definecolorseries{foo}{rgb}{last}{.}{-.}| will set up a series that starts with the current color and ends with its complement.
1307 % Of course, similar to \TeX's |\let| primitive, the \emph{current} definition of the current color at the time of execution is used, there is no relation to current colors in any later stage of the document.
1308 %
1309 %
1310 % \subsubsection{Initialisation of a color series}
1311 %
1312 % \DescribeMacro\resetcolorseries
1313 % \oarg{div}\marg{name}\\
1314 % This command has to be applied at least once, in order to make use of the color series \Meta{name}.
1315 % It resets the current color of the series to the base color and calculates the actual step vector according to the chosen \Meta{div}, a non-zero real number, for the methods |grad| and |last|, see equation (\ref{eq.cs}).
1316 % \DescribeMacro\colorseriescycle
1317 % If the optional argument is empty, the value stored in the macro |\colorseriescycle| is applied.
1318 % Its default value is \colorseriescycle, which can be changed by |\def\colorseriescycle|\marg{div}, applied \emph{before} the \XCP{} is loaded (similar to |\rangeRGB| and friends).
1319 % The optional argument is ignored in case of the |step| method.
1320 %
1321 %
1322 % \subsubsection{Application of a color series}
1323 %
1324 % There are two ways to display the current color of a color series:
1325 % any of the \emph{color expressions} in section \vref{sec.term} used within a |\color|, |\textcolor|, \dots{} command will display this color according to the usual syntax of such expressions.
1326 % However, in the cases when \Meta{postfix} equals `|!!+|', |\color{|\Meta{name}|!!+}| etc., will not only display the color, but it will also perform a step operation.
1327 % Thus, the current color of the series will be changed in that case.
1328 % An expression |\color{|\Meta{name}|!![|\Meta{num}|]}| enables direct access to an element of a series, where \Meta{num} = $0,1,2,\dots$, starting with~0 for the base color.
1329 % See figure \vref{fig.csx} for a demonstration of different methods.
1330 %
1331 %
1332 % \subsubsection{Differences between colors and color series}
1333 %
1334 % Although they behave similar if applied within color expressions, the objects defined by |\definecolor| and |\definecolorseries| are fundamentally different with respect to their scope/availability:
1335 % like \LC's original |\definecolor| command, |\definecolor| generates \emph{local} colors, whereas |\definecolorseries| generates \emph{global} objects (otherwise it would not be possible to use the stepping mechanism within tables or graphics conveniently).
1336 % E.g., if we assume that |bar| is an undefined color, then after saying
1337 % \begin{verbatim}
1338 % \begingroup
1339 % \definecolorseries{foo}{rgb}{last}{red}{blue}
1340 % \resetcolorseries[10]{foo}
1341 % \definecolor{bar}{rgb}{.6,.5,.4}
1342 % \endgroup
1343 % \end{verbatim}
1344 % commands like |\color{foo}| or |\color{foo!!+}| may be used without restrictions, whereas |\color{bar}| will give an error message.
1345 % However, it is possible to say |\colorlet{bar}{foo}| or |\colorlet{bar}{foo!!+}| in order to save the current color of a series locally --- with or without stepping.
1346 %
1347 %
1348 %
1349 %
1350 % \subsection{Border colors for hyperlinks}\label{sec.hyperref}
1351 %
1352 % \textbf{Change 2022}: The options described in this subsection have been removed from the code
1353 % as no longer relevant. \Package{hyperref} can handle color names in the border color keys.
1354 %
1355 % This affects the package options \Option{hyperref}, and the Keys
1356 % \Key{xcitebordercolor}, \Key{xfilebordercolor}, \Key{xlinkbordercolor}, \Key{xmenubordercolor},
1357 % \Key{xpagebordercolor}, \Key{xrunbordercolor}, \Key{xurlbordercolor} and \Key{xpdfborder}.
1358 %
1359 %
1360 % The \Package{hyperref} package offers all kinds of support for hyperlinks, pdfmarks etc.
1361 % There are two standard ways to make hyperlinks visible (see the package documentation \cite{hyperref} for additional information on how to set up these features):
1362 % \begin{itemize}
1363 % \item print hyperlinks in a different color than normal text, using the keys \Key{citecolor}, \Key{filecolor}, \Key{linkcolor}, \Key{menucolor}, \Key{pagecolor}, \Key{runcolor}, \Key{urlcolor} with color expressions, e.g., |\hypersetup{urlcolor=-green!50}|;
1364 % \item display a colored border around hyperlinks, using the keys \Key{citebordercolor}, \Key{filebordercolor}, \Key{linkbordercolor}, \Key{menubordercolor}, \Key{pagebordercolor}, \Key{runbordercolor}, \Key{urlbordercolor} with explicit numerical \Model{rgb} parameter specification, e.g., |\hypersetup{urlbordercolor={1 0.5 0.25}}|.
1365 % \end{itemize}
1366 % Obviously, the second method is somewhat inconvenient since it does not allow for color names or even color expressions.
1367 % Therefore, \XC{} provides --- via the package option \Option{hyperref} --- a set of extended keys \Key{xcitebordercolor}, \Key{xfilebordercolor}, \Key{xlinkbordercolor}, \Key{xmenubordercolor}, \Key{xpagebordercolor}, \Key{xrunbordercolor}, \Key{xurlbordercolor} which are being used in conjunction with color expressions, e.g., |\hypersetup{xurlbordercolor=-green!50}|.
1368 %
1369 % Another new key, \Key{xpdfborder}, provides a way to deal with a \Program{dvips}-related problem:
1370 % for most of the drivers, a setting like |pdfborder={0 0 1}| will determine the width of the border that is drawn around hyperlinks in points.
1371 % However, in the \Program{dvips} case, the numerical parameters are interpreted in relation to the chosen output resolution for processing the \File{.dvi} file into a \File{.ps} file.
1372 % Unfortunately, at the time when the \File{.dvi} is constructed, nobody knows if and at which resolution a transformation into \File{.ps} will take place afterwards.
1373 % Consequently, any default value for \Key{pdfborder} may be useful or not.
1374 % Within \Package{hyperref}, the default for \Program{dvips} is |pdfborder={0 0 12}|, which works fine for a resolution of 600 or 1200 dpi, but which produces an invisible border for a resolution of 8000 dpi, as determined by the command-line switch |-Ppdf|.
1375 % On the other hand, setting |pdfborder={0 0 80}| works fine for \Program{dvips} at 8000 dpi, but makes a document unportable, since other drivers (or even |dvips| in a low resolution) will draw very thick boxes in that case.
1376 % This is were the \Key{xpdfborder} key comes in handy: it rescales its arguments for the |dvips| case by a factor 80 (ready for 8000 dpi) and leaves everything unchanged for other drivers.
1377 % Thus one can say |xpdfborder={0 0 1}| in a driver-independent way.
1378 %
1379 %
1380 %
1381 % \subsection{Additional color specification in the \Package{pstricks} world}\label{sec.pstricks}
1382 %
1383 % For \Package{pstricks} users, there are different ways of invoking colors within command option keys:
1384 % \begin{itemize}
1385 % \item |\psset{linecolor=green!50}|
1386 % \item |\psset{linecolor=[rgb]{0.5,1,0.5}}|
1387 % \item |\psframebox[linecolor={[rgb]{0.5,1,0.5}}]{foo}|
1388 % \end{itemize}
1389 % Note the additional curly braces in the last case; without them, the optional argument of |\psframebox| would be terminated too early.
1390 %
1391 % \DescribeMacro\definecolor
1392 % |[ps]|\marg{name}\marg{core model-list}\marg{code}\\
1393 % Stores \Index{PostScript} \Meta{code} --- that should not contain slash~`|/|' characters --- within a color.
1394 % Example:
1395 % after |\definecolor[ps]{foo}{rgb}{bar}|, the \Package{pstricks} command |\psline[linecolor=foo]...| inserts `|bar setrgbcolor|' where the linecolor information is required --- at least in case of the \Option{dvips} driver.
1396 % See also \href{xcolor2.pdf}{\File{xcolor2.tex}} for an illustrative application.
1397 %
1398 %
1399 %
1400 % \subsection{Color in tables}
1401 % The commands in this subsection
1402 % were in previous versions provided by the \Package{xcolor} package as
1403 % an extension of the \Package{colortbl} commands. They have now
1404 % been merged into the \Package{colortbl} package properly. The package can be loaded
1405 % either with the \Option{table} option or independently with |\usepackage|.
1406 % The description of the commands is kept only for historical reasons. If in doubt
1407 % consult the documentation of \Package{colortbl}.
1408 %
1409 % \DescribeMacro\rowcolors
1410 % \oarg{commands}\marg{row}\marg{odd-row color}\marg{even-row color}\\
1411 % \DescribeMacro{\rowcolors*}
1412 % \oarg{commands}\marg{row}\marg{odd-row color}\marg{even-row color}\\
1413 % One of these commands has to be executed \emph{before} a table starts.
1414 % \Meta{row} tells the number of the first row which should be colored according to the \Meta{odd-row color} and \Meta{even-row color} scheme.
1415 % Each of the color arguments may also be left empty (= no color).
1416 % In the starred version, \Meta{commands} are ignored in rows with inactive \emph{rowcolors status} (see below), whereas in the non-starred version, \Meta{commands} are applied to every row of the table.
1417 % Such optional commands may be |\hline| or |\noalign|\marg{stuff}.
1418 %
1419 % \DescribeMacro\showrowcolors
1420 % \DescribeMacro\hiderowcolors
1421 % The \emph{rowcolors status} is activated (i.e., use coloring scheme) by default and/or |\showrowcolors|, it is inactivated (i.e., ignore coloring scheme) by the command |\hiderowcolors|.
1422 % \DescribeMacro\rownum
1423 % The counter |\rownum| may be used within such a table to access the current row number.
1424 % An example is given in figure \vref{fig.row}.
1425 %
1426 % Note that table coloring may be combined with color series.
1427 % This method was used to construct the examples in figure \vref{fig.csx}.
1428 %
1429 %
1430 %
1431 % \subsection{Color information}\label{sec.info}
1432 %
1433 % \DescribeMacro\extractcolorspec
1434 % \marg{color}\marg{cmd}\\
1435 % Extracts the color specification of \Meta{color} and puts it into \Meta{cmd}; equivalent to |\def\cmd{|\marg{model}\marg{spec}|}|.
1436 %
1437 % \DescribeMacro\extractcolorspecs
1438 % \marg{color}\marg{model-cmd}\marg{color-cmd}\\
1439 % Extracts the color specification of \Meta{color} and puts it into \Meta{model-cmd} and \Meta{color-cmd}, respectively.
1440 %
1441 % \medskip
1442 % \DescribeMacro\tracingcolors
1443 % |=|\Meta{int}\\
1444 % Controls the amount of information that is written into the |log| file:
1445 % \begin{itemize}
1446 % \item \mbox{$\Meta{int}\le0$:}~no specific color logging.
1447 % \item \mbox{$\Meta{int}\ge1$:}~ignored color definitions due to |\providecolor| are logged.
1448 % \item \mbox{$\Meta{int}\ge2$:}~multiple (i.e.~overwritten) color definitions are logged.
1449 % \item \mbox{$\Meta{int}\ge3$:}~every command that defines a color will be logged.
1450 % \item \mbox{$\Meta{int}\ge4$:}~every command that sets a color will be logged.
1451 % \end{itemize}
1452 % Like \TeX's |\tracing...| commands, this command may be used globally (in the document preamble) or locally/block-wise.
1453 % The package sets |\tracingcolors=0| as default.
1454 % Remark: since registers are limited and valuable, no counter is wasted for this issue.
1455 %
1456 % Note that whenever a color is used that has been defined via \LC's |\definecolor| command rather than \XC's new |\definecolor| and friends, a warning message `Incompatible color definition' will be issued.\footnote{This should not happen since usually there is no reason to load \LC{} in parallel to \XC{}.}
1457 %
1458 %
1459 %
1460 % \subsection{Color conversion}
1461 %
1462 % \DescribeMacro\convertcolorspec
1463 % \marg{model}\marg{spec}\marg{target model}\marg{cmd}\\
1464 % Converts a color, given by the \Meta{spec} in model \Meta{model}, into \Meta{target model} and stores the new color specification in |\cmd|.
1465 % \Meta{target model} must be of type \Meta{num model}, whereas \Meta{model} may also be `named', in which case \Meta{spec} is simply the name of the color.
1466 %
1467 % Example: |\convertcolorspec{cmyk}{0.81,1,0,0.07}{HTML}\tmp| acts like |\def| |\tmp{1F00ED}|.
1468 %
1469 %
1470 %
1471 % \subsection{Problems and solutions}
1472 %
1473 % \subsubsection{Name clashs between \Option{dvipsnames} and \Option{svgnames}}\label{sec.clash}
1474 %
1475 % Due to the fixed option processing order (which does not depend on the order how the options were specified in the |\usepackage| command), the \Option{svgnames} colors will always overrule \Option{dvipsnames} colors with identical names.
1476 % This can lead to undesired results if both options are used together.
1477 % For instance, \Color{Fuchsia} yields \testclr[cmyk]{0.47,0.91,0,0.08} under the regime of \Option{dvipsnames} and \testclr[rgb]{1,0,1} with respect to \Option{svgnames}.
1478 % However, there is a simple trick --- based on \emph{deferred color definition} --- that allows us to use colors from both sets in the desired way:
1479 % \begin{verbatim}
1480 % \usepackage[dvipsnames*,svgnames]{xcolor}
1481 % \definecolors{Fuchsia}
1482 % \end{verbatim}
1483 % Now all colors from the \Index{SVG} set are available (except \Color{Fuchsia}) plus \Color{Fuchsia} from the other set.
1484 %
1485 %
1486 % \subsubsection{Change color of included \File{.eps} file}\label{sec.fixinclude}
1487 %
1488 % In general, \XC{} cannot change colors of an image that is being included via the |\includegraphics| command from the \Package{graphics} or \Package{graphicx} package.
1489 % There is, however, a limited opportunity to influence the current color of included \Index{PostScript} files.
1490 % Consider the following file |foo.eps| which draws a framed gray box:
1491 % \begin{verbatim}
1492 % %!PS-Adobe-3.0 EPSF-3.0
1493 % %%BoundingBox: 0 0 60 12
1494 % 0 0 60 12 rectfill
1495 % 0.75 setgray
1496 % 2 2 56 8 rectfill
1497 % \end{verbatim}
1498 % Now run the following code through \LaTeX{} and \Program{dvips}:
1499 % \begin{verbatim}
1500 % \documentclass{minimal}
1501 % \usepackage[fixinclude]{xcolor}
1502 % \usepackage{graphics}
1503 % \begin{document}
1504 % \includegraphics{foo} \textcolor{red}{\includegraphics{foo}}
1505 % \end{document}
1506 % \end{verbatim}
1507 % The resulting \File{.ps} file will display two gray boxes: the first with a black frame, the second with a red frame.
1508 % If we had omitted the \Option{fixinclude} option, the second box would also display a black frame.
1509 % This is because \Program{dvips} usually resets the current color to black immediately before including an \File{.eps} file.
1510 %
1511 %
1512 %
1513 %
1514 % \clearpage
1515 % \begin{adjustwidth}{-2.5cm}{}
1516 % \section{Examples}
1517 %
1518 %
1519 % \begin{figure}[htbp]\caption{Color spectrum}\label{fig.spectrum}
1520 % \small
1521 % \newcount\WL \unitlength.75pt
1522 % \begin{picture}(460,60)(355,-10)
1523 % \sffamily \tiny \linethickness{1.25\unitlength} \WL=360
1524 % \multiput(360,0)(1,0){456}%
1525 % {{\color[wave]{\the\WL}\line(0,1){50}}\global\advance\WL1}
1526 % \linethickness{0.25\unitlength}\WL=360
1527 % \multiput(360,0)(20,0){23}%
1528 % {\picture(0,0)
1529 % \line(0,-1){5} \multiput(5,0)(5,0){3}{\line(0,-1){2.5}}
1530 % \put(0,-10){\makebox(0,0){\the\WL}}\global\advance\WL20
1531 % \endpicture}
1532 % \end{picture}
1533 % \vspace*{3ex}
1534 % \begin{verbatim}
1535 % \newcount\WL \unitlength.75pt
1536 % \begin{picture}(460,60)(355,-10)
1537 % \sffamily \tiny \linethickness{1.25\unitlength} \WL=360
1538 % \multiput(360,0)(1,0){456}%
1539 % {{\color[wave]{\the\WL}\line(0,1){50}}\global\advance\WL1}
1540 % \linethickness{0.25\unitlength}\WL=360
1541 % \multiput(360,0)(20,0){23}%
1542 % {\picture(0,0)
1543 % \line(0,-1){5} \multiput(5,0)(5,0){3}{\line(0,-1){2.5}}
1544 % \put(0,-10){\makebox(0,0){\the\WL}}\global\advance\WL20
1545 % \endpicture}
1546 % \end{picture}
1547 % \end{verbatim}
1548 % \end{figure}
1549 %
1550 %
1551 % \begin{figure}[htbp]\caption{Color testing}\label{fig.testcolors}
1552 % \small
1553 % \begin{adjustwidth}{-2.5cm}{}
1554 % \raggedleft
1555 % \sffamily
1556 % \begin{testcolors}[rgb,cmyk,hsb,HTML,gray]
1557 % \testcolor{olive}
1558 % \testcolor{red!50!green}
1559 % \testcolor{-cyan!50!magenta}
1560 % \testcolor[cmyk]{0,0,1,0.5}
1561 % \testcolor[cmyk]{0,0,.5,.5}
1562 % \testcolor[rgb:cmyk]{0,0,.5,.5}
1563 % \end{testcolors}
1564 % \end{adjustwidth}
1565 % \vspace*{3ex}
1566 % \begin{adjustwidth}{2.5cm}{}
1567 % \begin{verbatim}
1568 % \sffamily
1569 % \begin{testcolors}[rgb,cmyk,hsb,HTML,gray]
1570 % \testcolor{olive}
1571 % \testcolor{red!50!green}
1572 % \testcolor{-cyan!50!magenta}
1573 % \testcolor[cmyk]{0,0,1,0.5}
1574 % \testcolor[cmyk]{0,0,.5,.5}
1575 % \testcolor[rgb:cmyk]{0,0,.5,.5}
1576 % \end{testcolors}
1577 % \end{verbatim}
1578 % \end{adjustwidth}
1579 % \end{figure}
1580 %
1581 %
1582 % \def\ukColor{MyGreen}
1583 % \definecolor{\ukColor}{cmyk}{0.92,0,0.87,0.09}
1584 % \colorlet{\ukColor-rgb}[rgb]{\ukColor}
1585 % \colorlet{\ukColor-cmy}[cmy]{\ukColor}
1586 % \colorlet{\ukColor-hsb}[hsb]{\ukColor}
1587 % \colorlet{\ukColor-gray}[gray]{\ukColor}
1588 %
1589 % \begin{figure}[htbp]\caption{Progressing from one to another color}\label{fig.progress}
1590 % \small
1591 % \begin{adjustwidth}{-2.5cm}{}
1592 % \makeatletter
1593 % \def\ColorLoop#1#2{\@tfor\@@tmp:={}{-rgb}{-cmy}{-hsb}{-gray}\do
1594 % {\ifcase#1
1595 % \expandafter\Colorloop\expandafter{\expandafter\ukColor\@@tmp}{#2}\or
1596 % \expandafter\Colorshow\expandafter{\expandafter\ukColor\@@tmp}\fi}\\[-2ex]\ignorespaces}
1597 % \def\Colorloop#1#2{\@ifxempty{#1}{}{\texttt{#1!}}&
1598 % \count@105 \@whilenum\count@>\z@\do
1599 % {\advance\count@-5
1600 % \@ifxempty{#1}{\hb@xt@\XCdim{\hss\textsf{\the\count@}\hss}}{\testclr{#1!\the\count@!#2}}\hskip-\fboxrule}\hskip\fboxrule&
1601 % \@ifxempty{#1}{}{\texttt{!#2}}\\}
1602 % \def\Colorshow#1{\texttt{#1}&
1603 % \multicolumn2{l@{}}{\expandafter\let\expandafter\@@tmp\csname\string\color@#1\endcsname
1604 % \edef\@@tmp{\expandafter\@gobbletwo\@@tmp}\Meaning{@@tmp}}\\}
1605 % \makeatother
1606 % \sbox0{\testclr{red}}\XCdim\wd0
1607 % \begin{tabular}{@{}lll@{}}
1608 % \Colorloop{}{}\\[-2ex]
1609 % \ColorLoop0{white}
1610 % \ColorLoop0{gray}
1611 % \ColorLoop0{black}
1612 % \ColorLoop0{red}
1613 % \ColorLoop0{blue}
1614 % \ColorLoop0{yellow}
1615 % \\\noalign{\vspace*{-2.5ex}}\hline\noalign{\vspace*{1.5ex}}
1616 % \itshape Color&\itshape Definition/representation (\textup{\Option{\csname XC@@drv\endcsname}} driver)\\
1617 % \ColorLoop1{}
1618 % \end{tabular}
1619 % \end{adjustwidth}
1620 % \end{figure}
1621 %
1622 %
1623 % \begin{figure}[htbp]\caption{Target color model}\label{fig.tgt}
1624 % \small
1625 % \begin{adjustwidth}{-2.5cm}{}
1626 % \raggedleft
1627 % \extrarowheight2pt
1628 % \makeatletter
1629 % \def\X#1%
1630 % {\def\tmp{{#1}}\dots\Meaning{tmp}&
1631 % \selectcolormodel{#1}\testclr{red} \testclr{green} \testclr{blue} \testclr{cyan} \testclr{magenta} \testclr{yellow} \testclr{brown} \testclr{lime} \testclr{olive} \testclr{orange} \testclr{pink} \testclr{purple} \testclr{teal} \testclr{violet} \testclr{black} \testclr{darkgray} \testclr{gray} \testclr{lightgray} \testclr{white}\\}
1632 % \makeatother
1633 % \begin{tabular}{@{}>{\ttfamily}l@{ }l@{}}
1634 % \string\selectcolormodel&\\
1635 % \X{natural}
1636 % \X{rgb}
1637 % \X{cmy}
1638 % \X{cmyk}
1639 % \X{hsb}
1640 % \X{gray}
1641 % \end{tabular}
1642 % \end{adjustwidth}
1643 % \end{figure}
1644 %
1645 %
1646 % \begin{figure}[htbp]\caption{Standard color expressions}\label{fig.expr}
1647 % \centering\small
1648 % \def\test#1{\testclr{#1}& \texttt{#1}}
1649 % \def\X#1{\test{#1}& \test{-#1}}
1650 % \begin{tabular}{@{}l@{ \ }ll@{ \ }l@{}}
1651 % \X{red}\\
1652 % \X{red!75}\\
1653 % \X{red!75!green}\\
1654 % \X{red!75!green!50}\\
1655 % \X{red!75!green!50!blue}\\
1656 % \X{red!75!green!50!blue!25}\\
1657 % \X{red!75!green!50!blue!25!gray}\\
1658 % \end{tabular}
1659 % \end{figure}
1660 %
1661 %
1662 % \begin{figure}[htbp]\caption{Standard color expressions}\label{fig.ex}
1663 % \begin{minipage}{\textwidth}\small
1664 % \begin{verbatim}
1665 % \fboxrule6pt
1666 % \fcolorbox
1667 % {red!70!green}% outer frame
1668 % {yellow!30!blue}% outer background
1669 % {\fcolorbox
1670 % {-yellow!30!blue}% inner frame
1671 % {-red!70!green}% inner background
1672 % {Test\textcolor{red!72.75}{Test}\color{-green}Test}}
1673 % \end{verbatim}
1674 % \end{minipage}\relax
1675 % \llap{\fboxrule6pt \fcolorbox
1676 % {red!70!green}{yellow!30!blue}{\fcolorbox
1677 % {-yellow!30!blue}{-red!70!green}{Test\textcolor{red!72.75}{Test}\color{-green}Test}}}
1678 % \end{figure}
1679 %
1680 %
1681 % \begin{figure}[htbp]\caption{Current color}\label{fig.cc}
1682 % \begin{minipage}{\textwidth}\small
1683 % \begin{verbatim}
1684 % \def\test{current, \textcolor{.!50}{50\%},
1685 % \textcolor{-.}{complement},
1686 % \textcolor{yellow!50!.}{mix}}
1687 % \textcolor{blue}{\test}\\
1688 % and \textcolor{red}{\test}\\
1689 % \def\Test{\color{.!80}Test}
1690 % \textcolor{blue}{\Test\Test\Test\Test\Test}\\
1691 % and \textcolor{red}{\Test\Test\Test\Test\Test}
1692 % \end{verbatim}
1693 % \end{minipage}\relax
1694 % \llap{\begin{minipage}{.5\textwidth}\small\raggedleft
1695 % \def\test{current, \textcolor{.!50}{50\%},
1696 % \textcolor{-.}{complement},
1697 % \textcolor{yellow!50!.}{mix}}
1698 % \textcolor{blue}{\test}\\
1699 % and \textcolor{red}{\test}\\
1700 % \def\Test{\color{.!80}Test}
1701 % \textcolor{blue}{\Test\Test\Test\Test\Test}\\
1702 % and \textcolor{red}{\Test\Test\Test\Test\Test}
1703 % \end{minipage}}
1704 % \end{figure}
1705 %
1706 %
1707 % \begin{figure}[htbp]\caption{Color series}\label{fig.csx}
1708 % \centering
1709 % \def\tabulartest#1{\definecolorseries{test}#1\resetcolorseries[12]{test}%
1710 % \rowcolors[\hline]{1}{test!!+}{test!!+}%
1711 % \begin{tabular}{c}
1712 % \number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\
1713 % \number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\
1714 % \number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\
1715 % \number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\
1716 % \end{tabular}}
1717 %
1718 % \begin{tabular}{@{}*{9}{c}@{}}
1719 % $S_1$ & $S_2$ & $G_1$ & $G_2$ & $L_1$ & $L_2$ & $L_3$ & $L_4$ & $L_5$ \\[3pt]
1720 % \tabulartest{{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}}&
1721 % \tabulartest{{hsb}{step}[hsb]{.575,1,1}{.11,-.05,0}}&
1722 % \tabulartest{{rgb}{grad}[rgb]{.95,.85,.55}{3,11,17}}&
1723 % \tabulartest{{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}}&
1724 % \tabulartest{{rgb}{last}[rgb]{.95,.85,.55}[rgb]{.05,.15,.55}}&
1725 % \tabulartest{{hsb}{last}[hsb]{.575,1,1}[hsb]{-.425,.15,1}}&
1726 % \tabulartest{{rgb}{last}{yellow!50}{blue}}&
1727 % \tabulartest{{hsb}{last}{yellow!50}{blue}}&
1728 % \tabulartest{{cmy}{last}{yellow!50}{blue}}\\
1729 % \end{tabular}
1730 %
1731 % \bigskip
1732 %
1733 % \footnotesize
1734 % \rowcolors{3}{tablerowcolor}{}
1735 % \begin{tabular}{>{$}l<{$}l}
1736 % \hline
1737 % \multicolumn2{>{\columncolor{tableheadcolor}}c}{\em Individual definitions}\\
1738 % S_1& |\definecolorseries{test}{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}|\\
1739 % S_2& |\definecolorseries{test}{hsb}{step}[hsb]{.575,1,1}{.11,-.05,0}|\\
1740 % G_1& |\definecolorseries{test}{rgb}{grad}[rgb]{.95,.85,.55}{3,11,17}|\\
1741 % G_2& |\definecolorseries{test}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}|\\
1742 % L_1& |\definecolorseries{test}{rgb}{last}[rgb]{.95,.85,.55}[rgb]{.05,.15,.55}|\\
1743 % L_2& |\definecolorseries{test}{hsb}{last}[hsb]{.575,1,1}[hsb]{-.425,.15,1}|\\
1744 % L_3& |\definecolorseries{test}{rgb}{last}{yellow!50}{blue}|\\
1745 % L_4& |\definecolorseries{test}{hsb}{last}{yellow!50}{blue}|\\
1746 % L_5& |\definecolorseries{test}{cmy}{last}{yellow!50}{blue}|\\
1747 % \hline
1748 % \multicolumn2{>{\columncolor{tableheadcolor}}c}{\em Common definitions}\\
1749 % \hiderowcolors
1750 % &|\resetcolorseries[12]{test}|\\
1751 % &|\rowcolors[\hline]{1}{test!!+}{test!!+}|\\
1752 % &|\begin{tabular}{c}|\\
1753 % &|\number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\|\\
1754 % &|\number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\|\\
1755 % &|\number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\|\\
1756 % &|\number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\|\\
1757 % &|\end{tabular}|\\
1758 % \hline
1759 % \end{tabular}
1760 % \end{figure}
1761 %
1762 %
1763 % \begin{figure}[htbp]\caption{Color masking}\label{fig.mask}
1764 % \begin{adjustwidth}{-2.5cm}{}
1765 % \small\raggedleft
1766 % \extrarowheight2pt
1767 % \makeatletter
1768 % \def\X#1#2{\edef\tmp{\@ifxempty{#1}{}{[#1]}{#2}}\dots\Meaning{tmp}&
1769 % \maskcolors[#1]{#2}\testclr{red} \testclr{green} \testclr{blue} \testclr{cyan} \testclr{magenta} \testclr{yellow} \testclr{brown} \testclr{lime} \testclr{olive} \testclr{orange} \testclr{pink} \testclr{purple} \testclr{teal} \testclr{violet} \testclr{black} \testclr{darkgray} \testclr{gray} \testclr{lightgray} \testclr{white}\\}\relax
1770 % \makeatother
1771 % \begin{tabular}{@{}>{\ttfamily}l@{ }l@{}}
1772 % \string\maskcolors&\\
1773 % \hline
1774 % \X{}{}
1775 % \hline
1776 % \X{cmyk}{cyan}
1777 % \X{cmyk}{magenta}
1778 % \X{cmyk}{yellow}
1779 % \X{cmyk}{black}
1780 % \hline
1781 % \X{cmyk}{red}
1782 % \X{cmyk}{green}
1783 % \X{cmyk}{blue}
1784 % \hline
1785 % \X{rgb}{red}
1786 % \X{rgb}{green}
1787 % \X{rgb}{blue}
1788 % \hline
1789 % \X{hsb}{red}
1790 % \X{hsb}{green}
1791 % \X{hsb}{blue}
1792 % \hline
1793 % \X{rgb}{gray}
1794 % \X{cmy}{gray}
1795 % \end{tabular}
1796 % \end{adjustwidth}
1797 % \end{figure}
1798 %
1799 %
1800 % \begin{figure}[htbp]\caption{Alternating row colors in tables: \cmd\rowcolors{} vs. \cmd\rowcolors\texttt*}\label{fig.row}
1801 % \centering
1802 % \begin{minipage}{\textwidth}
1803 % \begin{verbatim}
1804 % \rowcolors[\hline]{3}{green!25}{yellow!50} \arrayrulecolor{red!75!gray}
1805 % \begin{tabular}{ll}
1806 % test & row \number\rownum\\
1807 % test & row \number\rownum\\
1808 % test & row \number\rownum\\
1809 % test & row \number\rownum\\
1810 % \arrayrulecolor{black}
1811 % test & row \number\rownum\\
1812 % test & row \number\rownum\\
1813 % \rowcolor{blue!25}
1814 % test & row \number\rownum\\
1815 % test & row \number\rownum\\
1816 % \hiderowcolors
1817 % test & row \number\rownum\\
1818 % test & row \number\rownum\\
1819 % \showrowcolors
1820 % test & row \number\rownum\\
1821 % test & row \number\rownum\\
1822 % \multicolumn{1}%
1823 % {>{\columncolor{red!12}}l}{test} & row \number\rownum\\
1824 % \end{tabular}
1825 % \end{verbatim}
1826 % \end{minipage}
1827 % \hskip-.5\textwidth
1828 % \rowcolors[\hline]{3}{green!25}{yellow!50} \arrayrulecolor{red!75!gray}
1829 % \begin{tabular}{ll}
1830 % test & row \number\rownum\\
1831 % test & row \number\rownum\\
1832 % test & row \number\rownum\\
1833 % test & row \number\rownum\\
1834 % \arrayrulecolor{black}
1835 % test & row \number\rownum\\
1836 % test & row \number\rownum\\
1837 % \rowcolor{blue!25}
1838 % test & row \number\rownum\\
1839 % test & row \number\rownum\\
1840 % \hiderowcolors
1841 % test & row \number\rownum\\
1842 % test & row \number\rownum\\
1843 % \showrowcolors
1844 % test & row \number\rownum\\
1845 % test & row \number\rownum\\
1846 % \multicolumn{1}%
1847 % {>{\columncolor{red!12}}l}{test} & row \number\rownum\\
1848 % \end{tabular}
1849 % \qquad
1850 % \rowcolors*[\hline]{3}{green!25}{yellow!50}\arrayrulecolor{red!75!gray}
1851 % \begin{tabular}{ll}
1852 % test & row \number\rownum\\
1853 % test & row \number\rownum\\
1854 % test & row \number\rownum\\
1855 % test & row \number\rownum\\
1856 % \arrayrulecolor{black}
1857 % test & row \number\rownum\\
1858 % test & row \number\rownum\\
1859 % \rowcolor{blue!25}
1860 % test & row \number\rownum\\
1861 % test & row \number\rownum\\
1862 % \hiderowcolors
1863 % test & row \number\rownum\\
1864 % test & row \number\rownum\\
1865 % \showrowcolors
1866 % test & row \number\rownum\\
1867 % test & row \number\rownum\\
1868 % \multicolumn{1}%
1869 % {>{\columncolor{red!12}}l}{test} & row \number\rownum\\
1870 % \end{tabular}
1871 % \arrayrulecolor{black}
1872 % \end{figure}
1873 %
1874 %
1875 % \begin{figure}[htbp]\caption{\Model{Hsb} and \Model{tHsb}: \emph{hue\Circ} in $15^\circ$ steps}\label{fig.tHsb}
1876 % \begin{adjustwidth}{-2.5cm}{}
1877 % \footnotesize\sffamily\raggedleft
1878 % \extrarowheight.5pt
1879 % \begin{testcolors}[rgb,cmyk,hsb,Hsb,tHsb]
1880 % \testcolor[Hsb]{0,1,1}
1881 % \testcolor[Hsb]{15,1,1}
1882 % \testcolor[Hsb]{30,1,1}
1883 % \testcolor[Hsb]{45,1,1}
1884 % \testcolor[Hsb]{60,1,1}
1885 % \testcolor[Hsb]{75,1,1}
1886 % \testcolor[Hsb]{90,1,1}
1887 % \testcolor[Hsb]{105,1,1}
1888 % \testcolor[Hsb]{120,1,1}
1889 % \testcolor[Hsb]{135,1,1}
1890 % \testcolor[Hsb]{150,1,1}
1891 % \testcolor[Hsb]{165,1,1}
1892 % \testcolor[Hsb]{180,1,1}
1893 % \testcolor[Hsb]{195,1,1}
1894 % \testcolor[Hsb]{210,1,1}
1895 % \testcolor[Hsb]{225,1,1}
1896 % \testcolor[Hsb]{240,1,1}
1897 % \testcolor[Hsb]{255,1,1}
1898 % \testcolor[Hsb]{270,1,1}
1899 % \testcolor[Hsb]{285,1,1}
1900 % \testcolor[Hsb]{300,1,1}
1901 % \testcolor[Hsb]{315,1,1}
1902 % \testcolor[Hsb]{330,1,1}
1903 % \testcolor[Hsb]{345,1,1}
1904 % \testcolor[Hsb]{360,1,1}
1905 % \noalign{\medskip}
1906 % \testcolor[tHsb]{0,1,1}
1907 % \testcolor[tHsb]{15,1,1}
1908 % \testcolor[tHsb]{30,1,1}
1909 % \testcolor[tHsb]{45,1,1}
1910 % \testcolor[tHsb]{60,1,1}
1911 % \testcolor[tHsb]{75,1,1}
1912 % \testcolor[tHsb]{90,1,1}
1913 % \testcolor[tHsb]{105,1,1}
1914 % \testcolor[tHsb]{120,1,1}
1915 % \testcolor[tHsb]{135,1,1}
1916 % \testcolor[tHsb]{150,1,1}
1917 % \testcolor[tHsb]{165,1,1}
1918 % \testcolor[tHsb]{180,1,1}
1919 % \testcolor[tHsb]{195,1,1}
1920 % \testcolor[tHsb]{210,1,1}
1921 % \testcolor[tHsb]{225,1,1}
1922 % \testcolor[tHsb]{240,1,1}
1923 % \testcolor[tHsb]{255,1,1}
1924 % \testcolor[tHsb]{270,1,1}
1925 % \testcolor[tHsb]{285,1,1}
1926 % \testcolor[tHsb]{300,1,1}
1927 % \testcolor[tHsb]{315,1,1}
1928 % \testcolor[tHsb]{330,1,1}
1929 % \testcolor[tHsb]{345,1,1}
1930 % \testcolor[tHsb]{360,1,1}
1931 % \end{testcolors}
1932 % \end{adjustwidth}
1933 % \end{figure}
1934 %
1935 %
1936 % \begin{figure}[htbp]\caption{Color harmony}\label{fig.harmony}
1937 % \begin{adjustwidth}{-2.5cm}{}
1938 % \small\sffamily\raggedleft
1939 % \extrarowheight1.5pt
1940 % \begin{testcolors}[rgb,cmyk,Hsb,tHsb]
1941 % \noalign{\smallskip}
1942 % \rlap{\em complementary colors (two-color harmony):}\\
1943 % \testcolor{yellow>wheel,1,2}
1944 % \testcolor{yellow}
1945 % \testcolor{yellow>twheel,1,2}
1946 % \noalign{\medskip}
1947 % \rlap{\em color triad (three-color harmony):}\\
1948 % \testcolor{yellow>wheel,2,3}
1949 % \testcolor{yellow>wheel,1,3}
1950 % \testcolor{yellow}
1951 % \testcolor{yellow>twheel,1,3}
1952 % \testcolor{yellow>twheel,2,3}
1953 % \noalign{\medskip}
1954 % \rlap{\em color tetrad (four-color harmony):}\\
1955 % \testcolor{yellow>wheel,3,4}
1956 % \testcolor{yellow>wheel,2,4}
1957 % \testcolor{yellow>wheel,1,4}
1958 % \testcolor{yellow}
1959 % \testcolor{yellow>twheel,1,4}
1960 % \testcolor{yellow>twheel,2,4}
1961 % \testcolor{yellow>twheel,3,4}
1962 % \noalign{\medskip}
1963 % \rlap{\em split complementary colors:}\\
1964 % \testcolor{yellow>wheel,7,12}
1965 % \testcolor{yellow>wheel,5,12}
1966 % \testcolor{yellow}
1967 % \testcolor{yellow>twheel,5,12}
1968 % \testcolor{yellow>twheel,7,12}
1969 % \noalign{\medskip}
1970 % \rlap{\em analogous (adjacent) colors:}\\
1971 % \testcolor{yellow>wheel,11,12}
1972 % \testcolor{yellow>wheel,10,12}
1973 % \testcolor{yellow>wheel,2,12}
1974 % \testcolor{yellow>wheel,1,12}
1975 % \testcolor{yellow}
1976 % \testcolor{yellow>twheel,1,12}
1977 % \testcolor{yellow>twheel,2,12}
1978 % \testcolor{yellow>twheel,10,12}
1979 % \testcolor{yellow>twheel,11,12}
1980 % \end{testcolors}
1981 % \end{adjustwidth}
1982 % \end{figure}
1983 %
1984 % \end{adjustwidth}
1985 %
1986 %
1987 % \clearpage
1988 %
1989 % \begin{adjustwidth}{-2.5cm}{}
1990 % \raggedcolumns\columnsep2.5em
1991 %
1992 % \section{Colors by Name}\label{sec.names}
1993 %
1994 % \begin{multicols}{5}[\subsection{Base colors (always available)}\label{sec.basenam}]
1995 % \footnotesize\def\0#1{\Testclr{#1}{#1}}
1996 % \0{black}
1997 % \0{blue}
1998 % \0{brown}
1999 % \0{cyan}
2000 % \0{darkgray}
2001 % \0{gray}
2002 % \0{green}
2003 % \0{lightgray}
2004 % \0{lime}
2005 % \0{magenta}
2006 % \0{olive}
2007 % \0{orange}
2008 % \0{pink}
2009 % \0{purple}
2010 % \0{red}
2011 % \0{teal}
2012 % \0{violet}
2013 % \0{white}
2014 % \0{yellow}
2015 % \end{multicols}
2016 %
2017 %
2018 % \begin{multicols}{5}[\subsection{Colors via \Option{dvipsnames} option}\label{sec.dvipsnam}]
2019 % \footnotesize\def\0#1{\Testclr{#1}{#1}}
2020 % \0{Apricot}
2021 % \0{Aquamarine}
2022 % \0{Bittersweet}
2023 % \0{Black}
2024 % \0{Blue}
2025 % \0{BlueGreen}
2026 % \0{BlueViolet}
2027 % \0{BrickRed}
2028 % \0{Brown}
2029 % \0{BurntOrange}
2030 % \0{CadetBlue}
2031 % \0{CarnationPink}
2032 % \0{Cerulean}
2033 % \0{CornflowerBlue}
2034 % \0{Cyan}
2035 % \0{Dandelion}
2036 % \0{DarkOrchid}
2037 % \0{Emerald}
2038 % \0{ForestGreen}
2039 % \0{Fuchsia}
2040 % \0{Goldenrod}
2041 % \0{Gray}
2042 % \0{Green}
2043 % \0{GreenYellow}
2044 % \0{JungleGreen}
2045 % \0{Lavender}
2046 % \0{LimeGreen}
2047 % \0{Magenta}
2048 % \0{Mahogany}
2049 % \0{Maroon}
2050 % \0{Melon}
2051 % \0{MidnightBlue}
2052 % \0{Mulberry}
2053 % \0{NavyBlue}
2054 % \0{OliveGreen}
2055 % \0{Orange}
2056 % \0{OrangeRed}
2057 % \0{Orchid}
2058 % \0{Peach}
2059 % \0{Periwinkle}
2060 % \0{PineGreen}
2061 % \0{Plum}
2062 % \0{ProcessBlue}
2063 % \0{Purple}
2064 % \0{RawSienna}
2065 % \0{Red}
2066 % \0{RedOrange}
2067 % \0{RedViolet}
2068 % \0{Rhodamine}
2069 % \0{RoyalBlue}
2070 % \0{RoyalPurple}
2071 % \0{RubineRed}
2072 % \0{Salmon}
2073 % \0{SeaGreen}
2074 % \0{Sepia}
2075 % \0{SkyBlue}
2076 % \0{SpringGreen}
2077 % \0{Tan}
2078 % \0{TealBlue}
2079 % \0{Thistle}
2080 % \0{Turquoise}
2081 % \0{Violet}
2082 % \0{VioletRed}
2083 % \0{White}
2084 % \0{WildStrawberry}
2085 % \0{Yellow}
2086 % \0{YellowGreen}
2087 % \0{YellowOrange}
2088 % \end{multicols}
2089 %
2090 %
2091 % \makeatletter
2092 % \def\ColorList#1#2#3#4{\begin{multicols}{#1}[\subsection{Colors via \Option{#2names} option}\label{sec.#2nam}]
2093 % \footnotesize
2094 % \def\preparecolorset
2095 % {\def\XC@@cmd[####1]####2####3####4{\definecolor[####1]{@test}{####3}{####4}#4{@test}{####2}}\@testopt{\XC@definecolorset}{}}
2096 % \edef\restore{\catcode`\noexpand\%\the\catcode`\%\relax}
2097 % \catcode`\%14\relax\input{#3nam.def}\restore
2098 % \end{multicols}}
2099 % \makeatother
2100 %
2101 % \ColorList4{svg}{svg}\Testclr
2102 % \medskip
2103 % \begin{adjustwidth}{1cm}{1cm}
2104 % \footnotesize\raggedright Duplicate colors:
2105 % \Color[-]{Aqua} = \Color[-]{Cyan},
2106 % \Color[-]{Fuchsia} = \Color[-]{Magenta};
2107 % \Color[-]{Navy} = \Color[-]{NavyBlue};
2108 % \Color[-]{Gray} = \Color[-]{Grey},
2109 % \Color[-]{DarkGray} = \Color[-]{DarkGrey},
2110 % \Color[-]{LightGray} = \Color[-]{LightGrey},
2111 % \Color[-]{SlateGray} = \Color[-]{SlateGrey},
2112 % \Color[-]{DarkSlateGray} = \Color[-]{DarkSlateGrey},
2113 % \Color[-]{LightSlateGray} = \Color[-]{LightSlateGrey},
2114 % \Color[-]{DimGray} = \Color[-]{DimGrey}.
2115 % \par\smallskip
2116 % \Index{HTML4} color keyword subset:
2117 % \Color[-]{Aqua}, \Color[-]{Black}, \Color[-]{Blue}, \Color[-]{Fuchsia},
2118 % \Color[-]{Gray}, \Color[-]{Green}, \Color[-]{Lime}, \Color[-]{Maroon},
2119 % \Color[-]{Navy}, \Color[-]{Olive}, \Color[-]{Purple}, \Color[-]{Red},
2120 % \Color[-]{Silver}, \Color[-]{Teal}, \Color[-]{White}, \Color[-]{Yellow}.
2121 % \par\smallskip
2122 % Colors taken from \Index{Unix}/\Index{X11}:
2123 % \Color[-]{LightGoldenrod},
2124 % \Color[-]{LightSlateBlue},
2125 % \Color[-]{NavyBlue},
2126 % \Color[-]{VioletRed}.
2127 % \end{adjustwidth}
2128 %
2129 % \ColorList4{x11}{x11}\Testclr
2130 % \medskip
2131 % \begin{adjustwidth}{1cm}{1cm}
2132 % \footnotesize\raggedright Duplicate colors:
2133 % \Color[-]{Gray0} = \Color[-]{Grey0},
2134 % \Color[-]{Green0} = \Color[-]{Green1}.
2135 % \end{adjustwidth}
2136 %
2137 % \end{adjustwidth}
2138 %
2139 %
2140 %
2141 %
2142 % \clearpage
2143 % \section{Technical Supplement}
2144 %
2145 % \subsection{Color models supported by drivers}
2146 %
2147 % Since some of the drivers only pretend to support the \Model{hsb} model, we included some code to bypass this behaviour.
2148 % The models actually added by \XC{} are shown in the log file.
2149 % Table \vref{tab.drv} lists mainly the drivers that are part of current MiK\TeX{} \cite{mik} distributions and their color model support.
2150 % Probably, other distributions behave similarly.
2151 %
2152 % \begin{table}[htbp]\caption{Drivers and color models}\label{tab.drv}
2153 % \centering\small
2154 % \extrarowheight1pt
2155 % \tabcolsep3pt
2156 % \rowcolors{3}{tablerowcolor}{}
2157 % \begin{tabular}{ll*{9}{c}}
2158 % \rowcolor{tableheadcolor}
2159 % \hline
2160 % \em Driver&\em Version&\Model{rgb}&\Model{cmy}&\Model{cmyk}&\Model{hsb}&\Model{gray}&\Model{RGB}&\Model{HTML}&\Model{HSB}&\Model{Gray}\\
2161 % \Option{dvipdf}&2015/12/30 v3.0k&d&n&d&n&d&i&n&n&n\\
2162 % \Option{dvips}&2015/12/30 v3.0k&d&n&d&d&d&i&n&n&n\\
2163 % \Option{dvipsone}&2015/12/30 v3.0k&d&n&d&d&d&i&n&n&n\\
2164 % \Option{pctex32}&2015/12/30 v3.0k&d&n&d&d&d&i&n&n&n\\
2165 % \Option{pctexps}&2015/12/30 v3.0k&d&n&d&d&d&i&n&n&n\\
2166 % \hline
2167 % \Option{pdftex}&2011/05/27 v0.06d&d&n&d&n&d&i&n&n&n\\
2168 % \Option{luatex}&2016/01/23 v0.01b&d&n&d&n&d&i&n&n&n\\
2169 % \hline
2170 % \Option{dvipdfm}&1999/9/6 vx.x&d&n&d&n&d&i&n&n&n\\
2171 % \Option{dvipdfmx}&2016/04/06 v4.08&d&n&d&?&d&i&n&n&n\\
2172 % \hline
2173 % \Option{textures}&1997/5/28 v0.3&d&n&d&?&i&n&n&n&n\\
2174 % \hline
2175 % \Option{vtex}&1999/01/14 v6.3&d&n&d&n&i&i&n&n&n\\
2176 % \hline
2177 % \Option{xetex}&2016/04/06 v4.08&d&n&d&d&d&i&n&n&n\\
2178 % \hline
2179 % \Option{tcidvi}&2015/12/30 v3.0k&i&n&i&n&i&d&n&n&n\\
2180 % \Option{truetex}&2015/12/30 v3.0k&i&n&i&n&i&d&n&n&n\\
2181 % \hline
2182 % \Option{dviwin}&2015/12/30 v3.0k&n&n&n&n&n&n&n&n&n\\
2183 % \Option{emtex}&2015/12/30 v3.0k&n&n&n&n&n&n&n&n&n\\
2184 % \Option{pctexhp}&2015/12/30 v3.0k&n&n&n&n&n&n&n&n&n\\
2185 % \Option{pctexwin}&2015/12/30 v3.0k&n&n&n&n&n&n&n&n&n\\
2186 % \hline\hline
2187 % \multicolumn{11}c{\Option{dviwindo} = \Option{dvipsone}; \Option{oztex} = \Option{dvips}; \Option{xdvi} = \Option{dvips} + \Option{monochrome}}\\
2188 % \hline
2189 % \multicolumn{11}c{Driver's color model support: d\,=\,direct, i\,=\,indirect, n\,=\,none}\\
2190 % \hline
2191 % \end{tabular}
2192 % \end{table}
2193 %
2194 %
2195 %
2196 % \subsection{How \XC{} handles driver-specific color models}
2197 %
2198 % Although there is a variety of drivers that implement different approaches to color visualisation, they all have some features in common, as defined by the original \LCP.
2199 % One of these features is that any color model `foo' requires a |\color@foo|\marg{cmd}\marg{spec} command in order to translate the `foo'-dependent color \Meta{spec} into some driver-specific code that is stored in \Meta{cmd}.
2200 % Therefore, \XC{} in general detects driver-support for the `foo' model via the existence of |\color@foo|.
2201 %
2202 % By this mechanism, \XC{} can also change the behaviour of certain models without touching the driver file itself.
2203 % A good example is the |\substitutecolormodel| command which is used during the package initialisation process to provide support for models that are not covered by the actual driver (like \Model{hsb} for \Option{pdftex}) or that have incorrect implementations (like \Model{hsb} for \Option{dvipdfm}).
2204 %
2205 %
2206 % \subsection{Behind the scenes: internal color representation}
2207 %
2208 % Every definition of a color in order to access it by its name requires an internal representation of the color, i.e.~a macro that contains some bits of information required by the driver to display the color properly.
2209 %
2210 % \LC's |\definecolor{foo}{...}{...}| generates a command |\\color@foo|\footnote{The double backslash is intentional.} which contains the color definition in a driver-dependent way; therefore it is possible but non-trivial to access the color model and parameters afterwards (see the \Package{colorinfo} package \cite{colorinfo} for a solution).
2211 %
2212 % \LC's |\DefineNamedColor{named}{foo}{...}{...}| generates |\col@foo|\footnote{The single backslash is intentional.} which again contains some driver-dependent information.
2213 % In this case, an additional |\\color@foo| will only be defined if the package option \Option{usecolors} is active.
2214 %
2215 % \XC's |\definecolor{foo}{...}{...}| generates\footnote{This was introduced in version 1.10; prior to that, a command \cs{\string\xcolor@foo} with a different syntax was generated.} a command |\\color@foo| as well, which combines the features of the former commands and contains both the driver-dependent and driver-independent information, thus making it possible to access the relevant parameters in a standardised way.
2216 % Although it has now a different syntax, |\\color@foo| expands to the same expression as the original command.
2217 % On the other hand, |\col@foo| commands are no longer needed and therefore not generated in the `named' case: \XC{} works with a single color data structure (as described).
2218 %
2219 % Table \vref{tab.internal} shows some examples for the two most prominent drivers.
2220 % See also figure \vref{fig.progress} which displays the definitions with respect to the driver that was used to process this document.
2221 %
2222 %
2223 % \begin{table}[htb]\caption{Driver-dependent internal color representation}\label{tab.internal}
2224 % \centering\small
2225 % \def\X{\hspace*{-.845\textwidth}\\}
2226 % \extrarowheight1pt
2227 % \tabcolsep8pt
2228 % \begin{tabular}{l>{\color{blue}(}r<{)}l}
2229 % \hline
2230 % \multicolumn3{>{\columncolor{tableheadcolor}}l}{\Option{dvips} driver}\\
2231 % \hline
2232 % |\\color@Plum=macro:| & |\definecolor{Plum}{rgb}{.5,0,1}| & \LC\\
2233 % |->rgb .5 0 1.|\X
2234 % \hline
2235 % |\\color@Plum=macro:| & |\definecolor{Plum}{rgb}{.5,0,1}|& \XC\\
2236 % |->\xcolor@ {}{rgb 0.5 0 1}{rgb}{0.5,0,1}.|\X
2237 % \hline
2238 % |\col@Plum=macro:| & |\DefineNamedColor{Plum}{rgb}{.5,0,1}|& \LC\\
2239 % |->\@nil .|\X
2240 % |\\color@Plum=macro:| & with option \oOption{usenames}\\
2241 % |-> Plum.|\X
2242 % \hline
2243 % |\\color@Plum=macro:| & |\definecolor[named]{Plum}{rgb}{.5,0,1}|& \XC\\
2244 % |->\xcolor@ {named}{ Plum}{rgb}{0.5,0,1}.|\X
2245 % \hline
2246 % \multicolumn3{>{\columncolor{tableheadcolor}}l}{\Option{pdftex} driver}\\
2247 % \hline
2248 % |\\color@Plum=macro:| & |\definecolor{Plum}{rgb}{.5,0,1}|& \LC\\
2249 % |->.5 0 1 rg .5 0 1 RG.|\X
2250 % \hline
2251 % |\\color@Plum=macro:| & |\definecolor{Plum}{rgb}{.5,0,1}|& \XC\\
2252 % |->\xcolor@ {}{0.5 0 1 rg 0.5 0 1 RG}{rgb}{0.5,0,1}.|\X
2253 % \hline
2254 % |\col@Plum=macro:| & |\DefineNamedColor{Plum}{rgb}{.5,0,1}|& \LC\\
2255 % |->.5 0 1 rg .5 0 1 RG.|\X
2256 % |\\color@Plum=macro:| & with option \oOption{usenames}\\
2257 % |->.5 0 1 rg .5 0 1 RG.|\X
2258 % \hline
2259 % |\\color@Plum=macro:| & |\definecolor[named]{Plum}{rgb}{.5,0,1}|& \XC\\
2260 % |->\xcolor@ {}{0.5 0 1 rg 0.5 0 1 RG}{rgb}{0.5,0,1}.|\X
2261 % \hline
2262 % \end{tabular}
2263 % \end{table}
2264 %
2265 %
2266 %
2267 % \subsection{A remark on accuracy}
2268 %
2269 % Since the macros presented here require some computation, special efforts were made to ensure a maximum of accuracy for conversion and mixing formulas --- all within \TeX's limited numerical capabilities.\footnote{For example, applying the `transformation' \cs{dimen0=0.}\Meta{int}\texttt{pt} \cs{the\string\dimen0} to all 5-digit numbers \Meta{int} of the range 00000\dots 99999, exactly 34464 of these 100000 numbers don't survive unchanged. We are not talking about gobbled final zeros here \dots}
2270 % We decided to develop and include a small set of commands to improve the quality of division and multiplication results, instead of loading one of the packages that provide multi-digit arithmetic and a lot more, like \Package{realcalc} or \Package{fp}.
2271 % The marginal contribution of the latter packages seems not to justify their usage for our purposes.
2272 % Thus, we stay within a sort of fixed-point arithmetic framework, providing at most 5~decimal digits via \TeX's dimension registers.
2273 %
2274 %
2275 %
2276 %
2277 % \clearpage
2278 % \section{The Formulas}
2279 %
2280 % \subsection{Color mixing}
2281 %
2282 % In general, we use linear interpolation for color mixing:
2283 % \begin{align}
2284 % \mix(C, C', p) = p \cdot C + (1-p) \cdot C'\label{eq.mix}
2285 % \end{align}
2286 % Note that there is a special situation in the \Model{hsb} case:
2287 % if $\emph{saturation}=0$ then the color equals a gray color of level \emph{brightness}, independently of the \emph{hue} value.
2288 % Therefore, to achieve smooth transitions of an arbitrary color to a specific gray (like white or black), we actually use the formulas
2289 % \begin{align}
2290 % \Op\tint{hsb}(C, p) &= p \cdot C + (1-p) \cdot \bigl(\emph{hue},0,1\bigr)\\
2291 % \Op\shade{hsb}(C, p) &= p \cdot C + (1-p) \cdot \bigl(\emph{hue},0,0\bigr)\\
2292 % \Op\tone{hsb}(C, p) &\textstyle= p \cdot C + (1-p) \cdot \bigl(\emph{hue},0,\frac12\bigr)
2293 % \end{align}
2294 % where $C=(\emph{hue},\emph{saturation},\emph{brightness})$.
2295 %
2296 % From equation (\ref{eq.mix}) and the way how color expressions are being interpreted, as described in section \vref{sec.term}, it is an easy proof by induction to verify that a color expression
2297 % \begin{gather}
2298 % C_0!P_1!C_1!P_2!\dots!P_n!C_n
2299 % \end{gather}
2300 % with $n\in\{0,1,2,\dots\}$, colors $C_0,C_1,\dots,C_n$, and percentages $P_1,\dots,P_n\in [0,100]$ will result in a parameter vector
2301 % \begin{equation}
2302 % \begin{split}
2303 % C &= \sum_{\nu=0}^n \Biggl(\prod_{\mu=\nu+1}^n p_\mu \Biggr) (1-p_\nu)\cdot C_\nu\\
2304 % &= p_n\cdots p_1\cdot C_0\\
2305 % &\quad + p_n\cdots p_2(1-p_1)\cdot C_1\\
2306 % &\quad + p_n\cdots p_3(1-p_2)\cdot C_2\\
2307 % &\quad + \dots\\
2308 % &\quad + p_n(1-p_{n-1})\cdot C_{n-1}\\
2309 % &\quad + (1-p_n)\cdot C_n
2310 % \end{split}
2311 % \end{equation}
2312 % where $p_0 := 0$ and $p_\nu := P_\nu/100$ for $\nu=1,\dots,n$.
2313 % We note also a split formula:
2314 % \begin{equation}
2315 % \begin{split}
2316 % C_0!P_1!C_1!\dots!P_{n+k}!C_{n+k}
2317 % &= p_{n+k}\cdots p_{n+1}\cdot C_0!P_1!C_1!\dots!P_n!C_n\\
2318 % &\quad - p_{n+k}\cdots p_{n+1}\cdot C_n\\
2319 % &\quad + C_n!P_{n+1}!C_{n+1}!\dots!P_{n+k}!C_{n+k}
2320 % \end{split}
2321 % \end{equation}
2322 %
2323 %
2324 % \begin{table}[p]\caption{Color constants}\label{tab.const}
2325 % \centering
2326 % \extrarowheight2pt
2327 % \rowcolors{3}{tablerowcolor}{}
2328 % \begin{tabular}{*4{c}}
2329 % \hline
2330 % \rowcolor{tableheadcolor}
2331 % \emph{model/constant} &
2332 % \ttfamily white & \ttfamily black & \ttfamily gray\\[2pt]
2333 % \Model{rgb}& $(1,1,1)$ & $(0,0,0)$ & $(\frac12,\frac12,\frac12)$ \\[2pt]
2334 % \Model{cmy}& $(0,0,0)$ & $(1,1,1)$ & $(\frac12,\frac12,\frac12)$ \\[2pt]
2335 % \Model{cmyk}& $(0,0,0,0)$ & $(0,0,0,1)$ & $(0,0,0,\frac12)$ \\[2pt]
2336 % \Model{hsb}& $(h,0,1)$ & $(h,0,0)$ & $(h,0,\frac12)$ \\[2pt]
2337 % \Model{Hsb}& $(h^\circ,0,1)$ & $(h^\circ,0,0)$ & $(h^\circ,0,\frac12)$ \\[2pt]
2338 % \Model{tHsb}& $(h^\circ,0,1)$ & $(h^\circ,0,0)$ & $(h^\circ,0,\frac12)$ \\[2pt]
2339 % \Model{gray}& $1$ & $0$ & $\frac12$ \\[2pt]
2340 % \Model{RGB}& $(L,L,L)$ & $(0,0,0)$ & $(\lfloor\frac {L+1}2\rfloor,\lfloor\frac {L+1}2\rfloor,\lfloor\frac {L+1}2\rfloor)$ \\[2pt]
2341 % \Model{HTML}& \texttt{FFFFFF}& \texttt{000000}& \texttt{808080}\\[2pt]
2342 % \Model{HSB}& $(H,0,M)$ & $(H,0,0)$ & $(H,0,\lfloor\frac {M+1}2\rfloor)$ \\[2pt]
2343 % \Model{Gray}& $N$ & $0$ & $\lfloor\frac {N+1}2\rfloor$ \\[2pt]
2344 % \hline
2345 % \end{tabular}
2346 % \end{table}
2347 %
2348 %
2349 % \begin{table}[p]\caption{Color conversion pairs}\label{tab.cnv}
2350 % \begin{adjustwidth}{-2.5cm}{}
2351 % \small\raggedleft
2352 % \def\Em#1{\Model{#1}}
2353 % \def\sp{\hbox to3em{\hfil$\ast$\hfil}}
2354 % \def\id{\textrm{id}}
2355 % \extrarowheight1pt
2356 % \tabcolsep3pt
2357 % \rowcolors{3}{tablerowcolor}{}
2358 % \begin{tabular}{c*{11}{>{\sffamily}c}}
2359 % \rowcolor{tableheadcolor}
2360 % \hline
2361 % \emph{from/to}&
2362 % \Em{rgb}& \Em{cmy}& \Em{cmyk}& \Em{hsb}& \Em{Hsb} & \Em{tHsb} & \Em{gray}& \Em{RGB}& \Em{HTML}& \Em{HSB}& \Em{Gray}\\
2363 % \Em{rgb}& \id & \sp & (cmy) & \sp & (hsb) & (hsb) & \sp & \sp & \sp & (hsb) & (gray)\\
2364 % \Em{cmy}& \sp & \id & \sp & (rgb) & (rgb) & (rgb) & \sp & (rgb) & (rgb) & (rgb) & (gray)\\
2365 % \Em{cmyk}& (cmy) & \sp & \id & (cmy) & (cmy) & (cmy) & \sp & (cmy) & (cmy) & (cmy) & (gray)\\
2366 % \Em{hsb}& \sp & (rgb) & (rgb) & \id & \sp & (Hsb) & (rgb) & (rgb) & (rgb) & \sp & (rgb)\\
2367 % \Em{Hsb}& (hsb) & (hsb) & (hsb) & \sp & \id & \sp & (hsb) & (hsb) & (hsb) & (hsb) & (hsb)\\
2368 % \Em{tHsb}& (Hsb) & (Hsb) & (Hsb) & (Hsb) & \sp & \id & (Hsb) & (Hsb) & (Hsb) & (Hsb) & (Hsb)\\
2369 % \Em{gray}& \sp & \sp & \sp & \sp & \sp & \sp & \id & \sp & \sp & \sp & \sp\\
2370 % \Em{RGB}& \sp & (rgb) & (rgb) & (rgb) & (rgb) & (rgb) & (rgb) & \id & (rgb) & (rgb) & (rgb)\\
2371 % \Em{HTML}& \sp & (rgb) & (rgb) & (rgb) & (rgb) & (rgb) & (rgb) & (rgb) & \id & (rgb) & (rgb)\\
2372 % \Em{HSB}& (hsb) & (hsb) & (hsb) & \sp & (hsb) & (hsb) & (hsb) & (hsb) & (hsb) & \id & (hsb)\\
2373 % \Em{Gray}& (gray) & (gray) & (gray) & (gray) & (gray) & (gray) & \sp & (gray) & (gray) & (gray) & \id\\
2374 % \Em{wave}& (hsb) & (hsb) & (hsb) & \sp & (hsb) & (hsb) & (hsb) & (hsb) & (hsb) & (hsb) & (hsb)\\
2375 % \hline\hline
2376 % \multicolumn{12}{c}{\id{} = identity function; $\ast$ = specific conversion function;}\\
2377 % \multicolumn{12}{c}{\textsf{(model)} = conversion via specified model}\\
2378 % \hline
2379 % \end{tabular}
2380 % \end{adjustwidth}
2381 % \end{table}
2382 %
2383 %
2384 %
2385 % \subsection{Conversion between integer and real models}
2386 %
2387 % We fix a positive integer $n$ and define the sets $\mathcal I_n:=\{0,1,\dots,n\}$ and $\mathcal R:= [0,1]$.
2388 % The complement of $\nu\in\mathcal I_n$ is $n-\nu$, the complement of $x\in\mathcal R$ is $1-x$.
2389 %
2390 % \subsubsection{Real to integer conversion}\label{sec.real2int}
2391 %
2392 % The straightforward mapping for this case is
2393 % \begin{gather}
2394 % \textstyle\RtoI n : \mathcal R \to \mathcal I_n,\ x \mapsto \rd(n\cdot x,0) = \left\lfloor \frac12+n\cdot x\right\rfloor
2395 % \end{gather}
2396 % where $\rd(r,d)$ rounds the real number $r$ to $d\ge0$ decimal digits.
2397 % This mapping nearly always preserves complements, as shown in the next lemma.
2398 % \begin{lemma}[Preservation of complements]
2399 % For $x\in\mathcal R$,
2400 % \begin{gather}
2401 % \textstyle\RtoI n(x) + \RtoI n(1-x) = n \iff x \notin \mathcal R_n^\circ := \left\{ \frac1n\bigl(\nu - \frac12\bigr) \bigm\vert \nu=1,2,\dots,n\right\}.
2402 % \end{gather}
2403 % \end{lemma}
2404 % \begin{proof}
2405 % Let $\nu:=\RtoI n(x)$, then from $-\frac12 \le \eta := n\cdot x - \nu < \frac12$ we conclude
2406 % \begin{gather*}
2407 % \textstyle \RtoI n(1-x) = \rd(n(1-x),0) = \rd(n-\nu-\eta,0) =
2408 % \begin{cases}
2409 % n-\nu & \text{if $\eta\neq-\frac12$}\\
2410 % n-\nu+1 & \text{if $\eta=-\frac12$}
2411 % \end{cases}
2412 % \end{gather*}
2413 % Now, $\eta = -\frac12 \iff x = \frac1n\bigl(\nu-\frac12\bigr) \iff x\in\mathcal I_n'$.
2414 % \end{proof}
2415 % Remark: the set $\mathcal R_n^\circ$ is obviously identical to the set of points where $\RtoI n$ is not continuous.
2416 %
2417 %
2418 % \subsubsection{Integer to real conversion}\label{sec.int2real}
2419 %
2420 % The straightforward way in this case is the function
2421 % \begin{gather}
2422 % \ItoR n^*: \mathcal I_n \to \mathcal R,\ \nu \mapsto \frac \nu n.
2423 % \end{gather}
2424 % This is, however, only one out of a variety of solutions: every function $\ItoR n:\mathcal I_n\to\mathcal R$ that obeys the condition
2425 % \begin{gather}
2426 % \nu\in\mathcal I_n \Rightarrow \Gamma_n\bigl(\ItoR n(\nu)\bigr) = \nu
2427 % \end{gather}
2428 % which is equivalent to
2429 % \begin{gather}
2430 % \nu\in\mathcal I_n \Rightarrow \nu + \frac12 > n\cdot\ItoR n(\nu) \ge \nu - \frac12\label{eq.round}
2431 % \end{gather}
2432 % does at least guarantee that all integers $\nu$ may be reconstructed from $\ItoR n(\nu)$ via multiplication by $n$ and rounding to the nearest integer.
2433 % Preservation of complements means now
2434 % \begin{gather}
2435 % \nu\in\mathcal I_n \Rightarrow \ItoR n(\nu) + \ItoR n(n-\nu) = 1
2436 % \end{gather}
2437 % which is obviously the case for $\ItoR n = \ItoR n^*$.
2438 % If we consider, more generally, a transformation
2439 % \begin{gather}
2440 % \ItoR n(\nu) = \frac{\nu + \alpha}{n + \beta}
2441 % \end{gather}
2442 % with $\beta\neq-n$, then the magic inequality (\ref{eq.round}) is equivalent to
2443 % \begin{gather}
2444 % \frac12 > \frac{\alpha n - \beta\nu}{n + \beta} \ge -\frac12
2445 % \end{gather}
2446 % which is obeyed by the function
2447 % \begin{gather}
2448 % \ItoR n':\mathcal I_n\to\mathcal R,\ \nu \mapsto
2449 % \begin{cases}
2450 % \frac\nu{n+1}& \text{if $\nu\le\frac{n+1}2$}\\[0.25ex]
2451 % \frac{\nu+1}{n+1}& \text{if $\nu>\frac{n+1}2$}
2452 % \end{cases}
2453 % \end{gather}
2454 % that has the nice feature $\ItoR n'\bigl(\frac{n+1}2\bigr) = \frac12$ for odd $n$.
2455 % \begin{lemma}[Preservation of complements]
2456 % For odd $n$ and each $\nu\in\mathcal I_n$,
2457 % \begin{gather}
2458 % \textstyle\ItoR n'(\nu) + \ItoR n'(n-\nu) = 1 \iff \nu \notin \mathcal I_n^\circ := \left\{ \frac{n-1}2, \frac{n+1}2 \right\}.
2459 % \end{gather}
2460 % \end{lemma}
2461 % \begin{proof}
2462 % The assertion is a consequence of the following arguments:
2463 % \begin{itemize}
2464 % \item $\nu<\frac{n-1}2 \iff n-\nu>\frac{n+1}2$ \ and \ $\frac{n-1}2 + \frac{n+1}2 = n$;
2465 % \item $\nu<\frac{n-1}2 \,\Rightarrow\, \ItoR n'(\nu) + \ItoR n'(n-\nu) = \frac\nu{n+1} + \frac{n-\nu+1}{n+1} = 1$;
2466 % \item $\nu=\frac{n-1}2 \,\Rightarrow\, \ItoR n'(\nu) + \ItoR n'(n-\nu) = \frac{n-1}{2(n+1)} + \frac12 = \frac n{n+1} \neq1$.\qedhere
2467 % \end{itemize}
2468 % \end{proof}
2469 %
2470 % For the time being, we choose \fbox{$\ItoR n := \ItoR n^*$} as default transformation function.
2471 %
2472 % \medskip
2473 % Another variant --- which is probably too slow for large-scale on-the-fly calculations --- may be used for constructing sets of predefined colors.
2474 % The basic idea is to minimize the number of decimal digits in the representation while keeping some invariance with respect to the original resolution:
2475 % \begin{gather}
2476 % \textstyle\ItoR n'':\mathcal I_n\to\mathcal R,\ \nu \mapsto \rd\bigl(\frac\nu n, d_n(\frac\nu n)\bigr)
2477 % \end{gather}
2478 % where
2479 % \begin{gather}
2480 % d_n:[0,1]\to\bbbN,\ x \mapsto \min\bigl\{ d\in\bbbN \bigm\vert \RtoI n\bigl(\rd(\ItoR n^*(\RtoI n(x)),d)\bigr) = \RtoI n(x)\bigr\}
2481 % \end{gather}
2482 % In the most common case $n=255$ it turns out that we end up with at most 3 decimal digits; preservation of complements is only violated for $\nu\in\{25,26,76,77,127,128,178,179,229,230\}$ where the corresponding set of decimal numbers is $\{0.098,0.1,0.298,0.3,0.498,0.5,0.698,0.7,0.898,0.9\}$.
2483 %
2484 %
2485 %
2486 % \subsection{Color conversion and complements}\label{sec.cnv}
2487 %
2488 % We collect here the specific conversion formulas between the supported color models.
2489 % Table \vref{tab.cnv} gives an overview of how each conversion pair is handled.
2490 % In general, \Index{PostScript} (as described in \cite{plrm}) is used as a basis for most of the calculations, since it supports the color models \Model{rgb}, \Model{cmyk}, \Model{hsb}, and \Model{gray} natively.
2491 % Furthermore, \People{Alvy Ray}{Smith}'s paper \cite{smith} is cited in \cite{plrm} as reference for \Model{hsb}-related formulas.
2492 %
2493 % First, we define a constant which is being used throughout the conversion formulas:
2494 % \begin{gather}
2495 % E := (1,1,1)
2496 % \end{gather}
2497 %
2498 %
2499 % \subsubsection{The \Model{rgb} model}
2500 %
2501 % \paragraph{Conversion \Model{rgb} to \Model{cmy}}\label{sec.rgb2cmy}
2502 % Source: \cite{plrm}, p. 475.
2503 % \begin{gather}
2504 % (\emph{cyan}, \emph{magenta}, \emph{yellow}) := E-(\emph{red}, \emph{green}, \emph{blue})
2505 % \end{gather}
2506 %
2507 %
2508 % \paragraph{Conversion \Model{rgb} to \Model{hsb} (1)}
2509 % We set
2510 % \begin{align}
2511 % x & := \max\{\emph{red}, \emph{green}, \emph{blue}\}\\
2512 % y & := \med\{\emph{red}, \emph{green}, \emph{blue}\}\\
2513 % z & := \min\{\emph{red}, \emph{green}, \emph{blue}\}%\\
2514 % \end{align}
2515 % where `$\med$' denotes the median of the values.
2516 % Then,
2517 % \begin{align}
2518 % \emph{brightness} & := x\\
2519 % \intertext{Case $x=z$:}
2520 % \emph{saturation} & := 0\\
2521 % \emph{hue} & := 0\\
2522 % \intertext{Case $x\neq z$:}
2523 % \emph{saturation} & := \frac{x - z}x\\
2524 % f & := \frac{x - y}{x - z}
2525 % \end{align}
2526 % \begin{gather}
2527 % \emph{hue} := \frac 16\cdot
2528 % \begin{cases}
2529 % 1-f & \text{if $x=\emph{red}\ge\emph{green}\ge\emph{blue}=z$}\\
2530 % 1+f & \text{if $x=\emph{green}\ge\emph{red}\ge\emph{blue}=z$}\\
2531 % 3-f & \text{if $x=\emph{green}\ge\emph{blue}\ge\emph{red}=z$}\\
2532 % 3+f & \text{if $x=\emph{blue}\ge\emph{green}\ge\emph{red}=z$}\\
2533 % 5-f & \text{if $x=\emph{blue}\ge\emph{red}\ge\emph{green}=z$}\\
2534 % 5+f & \text{if $x=\emph{red}\ge\emph{blue}>\emph{green}=z$}
2535 % \end{cases}\label{eq.rgb2hsb1}
2536 % \end{gather}
2537 %
2538 % \medskip
2539 %
2540 % This is based on \cite{smith}, \emph{RGB to HSV Algorithm (Hexcone Model)}, which reads (slightly reformulated):
2541 % \begin{gather}
2542 % r := \frac{x - \emph{red}}{x - z},\qquad
2543 % g := \frac{x - \emph{green}}{x - z},\qquad
2544 % b := \frac{x - \emph{blue}}{x - z}\\
2545 % \emph{hue} := \frac 16\cdot
2546 % \begin{cases}
2547 % 5+b & \text{if $\emph{red}=x$ and $\emph{green}=z$}\\
2548 % 1-g & \text{if $\emph{red}=x$ and $\emph{green}>z$}\\
2549 % 1+r & \text{if $\emph{green}=x$ and $\emph{blue}=z$}\\
2550 % 3-b & \text{if $\emph{green}=x$ and $\emph{blue}>z$}\\
2551 % 3+g & \text{if $\emph{blue}=x$ and $\emph{red}=z$}\\
2552 % 5-r & \text{if $\emph{blue}=x$ and $\emph{red}>z$}
2553 % \end{cases}
2554 % \end{gather}
2555 % Note that the singular case $x=z$ is not covered completely in Smith's original algorithm; we stick here to \Index{PostScript}'s behaviour in real life.
2556 %
2557 % Because we need to sort three numbers in order to calculate $x,y,z$, several comparisons are involved in the algorithm.
2558 % We present now a second method which is more suited for \TeX.
2559 %
2560 %
2561 % \paragraph{Conversion \Model{rgb} to \Model{hsb} (2)}
2562 % Let $\beta$ be a function that takes a Boolean expression as argument and returns 1 if the expression is true, 0 otherwise; set
2563 % \begin{gather}
2564 % i := 4\cdot\beta(\emph{red}\ge\emph{green}) + 2\cdot\beta(\emph{green}\ge\emph{blue}) + \beta(\emph{blue}\ge\emph{red}),
2565 % \intertext{and}
2566 % (\emph{hue},\emph{saturation},\emph{brightness}) :=
2567 % \begin{cases}
2568 % \Phi(\emph{blue},\emph{green},\emph{red},3,1) & \text{if $i=1$}\\
2569 % \Phi(\emph{green},\emph{red},\emph{blue},1,1) & \text{if $i=2$}\\
2570 % \Phi(\emph{green},\emph{blue},\emph{red},3,-1) & \text{if $i=3$}\\
2571 % \Phi(\emph{red},\emph{blue},\emph{green},5,1) & \text{if $i=4$}\\
2572 % \Phi(\emph{blue},\emph{red},\emph{green},5,-1) & \text{if $i=5$}\\
2573 % \Phi(\emph{red},\emph{green},\emph{blue},1,-1) & \text{if $i=6$}\\
2574 % (0,0,\emph{blue}) & \text{if $i=7$}
2575 % \end{cases}\label{eq.rgb2hsb2}
2576 % \intertext{where}
2577 % \Phi(x,y,z,u,v) := \Bigl( \frac{u\cdot(x-z)+v\cdot(x-y)}{6(x-z)}, \frac{x-z}x, x\Bigr)
2578 % \end{gather}
2579 %
2580 % The singular case $x=z$, which is equivalent to $\emph{red}=\emph{green}=\emph{blue}$, is covered here by $i=7$.
2581 %
2582 % \medskip
2583 %
2584 % It is not difficult to see that this algorithm is a reformulation of the previous method.
2585 % The following table explains how the transition from equation (\ref{eq.rgb2hsb1}) to equation (\ref{eq.rgb2hsb2}) works:
2586 %
2587 % \medskip
2588 %
2589 % \begin{tabular*}{\textwidth}{@{\extracolsep\fill}*5{>{$}c<{$}}l@{}}
2590 % 6\cdot\emph{hue}& \emph{Condition}& \emph{red}\ge\emph{green}& \emph{green}\ge\emph{blue}& \emph{blue}\ge\emph{red}& $i$\\\hline
2591 % 1-f & \emph{red}\ge\emph{green}\ge\emph{blue}& 1& 1& *& \textbf6/7\\
2592 % 1+f & \emph{green}\ge\emph{red}\ge\emph{blue}& *& 1& *& \textbf2/3/6/7\\
2593 % 3-f & \emph{green}\ge\emph{blue}\ge\emph{red}& *& 1& 1& \textbf3/7\\
2594 % 3+f & \emph{blue}\ge\emph{green}\ge\emph{red}& *& *& 1& \textbf1/3/5/7\\
2595 % 5-f & \emph{blue}\ge\emph{red}\ge\emph{green}& 1& *& 1& \textbf5/7\\
2596 % 5+f & \emph{red}\ge\emph{blue}\ge\emph{green}& 1& *& *& \textbf4/5/6/7\\
2597 % \end{tabular*}
2598 %
2599 % \medskip
2600 %
2601 % Here, $*$ denotes possible 0 or 1 values.
2602 % Bold $i$~values mark the main cases where all $*$~values of a row are zero.
2603 % The slight difference to equation (\ref{eq.rgb2hsb1}) in the last inequality is intentional and does no harm.
2604 %
2605 %
2606 % \paragraph{Conversion \Model{rgb} to \Model{gray}}
2607 % Source: \cite{plrm}, p. 474.
2608 % \begin{align}
2609 % \emph{gray} & := 0.3\cdot\emph{red} + 0.59\cdot\emph{green} + 0.11\cdot\emph{blue}
2610 % \end{align}
2611 %
2612 %
2613 % \paragraph{Conversion \Model{rgb} to \Model{RGB}}
2614 % As described in section \vref{sec.real2int}.
2615 % \begin{gather}
2616 % (\emph{Red},\emph{Green},\emph{Blue}) := \bigl(\RtoI L(\emph{red}), \RtoI L(\emph{green}), \RtoI L(\emph{blue})\bigr)
2617 % \end{gather}
2618 %
2619 %
2620 % \paragraph{Conversion \Model{rgb} to \Model{HTML}}
2621 % As described in section \vref{sec.real2int}.
2622 % Convert to 6-digit hexadecimal afterwards.
2623 % Certainly, multiplication and summation can be replaced by simple text concatenation of 2-digit hexadecimals.
2624 % \begin{gather}
2625 % \emph{RRGGBB} := \bigl( 65536\cdot\RtoI L(\emph{red}) + 256\cdot \RtoI L(\emph{green}) + \RtoI L(\emph{blue}) \bigr)_{\emph{hex}}
2626 % \end{gather}
2627 %
2628 %
2629 % \paragraph{Complement of \Model{rgb} color}
2630 % We simply take the complementary vector:
2631 % \begin{gather}
2632 % (\emph{red}^*, \emph{green}^*, \emph{blue}^*) := E - (\emph{red}, \emph{green}, \emph{blue})
2633 % \end{gather}
2634 %
2635 %
2636 % \subsubsection{The \Model{cmy} model}
2637 %
2638 % \paragraph{Conversion \Model{cmy} to \Model{rgb}}
2639 % This is simply a reversion of the $\Model{rgb}\to\Model{cmy}$ case, cf. section \vref{sec.rgb2cmy}.
2640 % \begin{gather}
2641 % (\emph{red}, \emph{green}, \emph{blue}) := E - (\emph{cyan}, \emph{magenta}, \emph{yellow})
2642 % \end{gather}
2643 %
2644 %
2645 % \paragraph{Conversion \Model{cmy} to \Model{cmyk}}\label{sec.cmy2cmyk}
2646 % This is probably the hardest of our conversion tasks: many sources emphasize that there does not exist any universal conversion algorithm for this case because of device-dependence.
2647 % The following algorithm is an extended version of the one given in \cite{plrm}, p. 476.
2648 % \begin{align}
2649 % k & := \min\{\emph{cyan},\emph{magenta},\emph{yellow}\}\\
2650 % \emph{cyan} & := \min\{1,\max\{0,\emph{cyan} - \emph{UCR}_c(k)\}\}\\
2651 % \emph{magenta} & := \min\{1,\max\{0,\emph{magenta} - \emph{UCR}_m(k)\}\}\\
2652 % \emph{yellow} & := \min\{1,\max\{0,\emph{yellow} - \emph{UCR}_y(k)\}\}\\
2653 % \emph{black} & := \emph{BG}(k)
2654 % \end{align}
2655 % Here, four additional functions are required:
2656 % \begin{align}
2657 % \emph{UCR}_c, \emph{UCR}_m, \emph{UCR}_y & : [0,1] \to [-1,1]\tag*{\em undercolor-removal}\\
2658 % \emph{BG} & : [0,1] \to [0,1]\tag*{\em black-generation}
2659 % \end{align}
2660 % These functions are device-dependent, see the remarks in \cite{plrm}.
2661 % Although there are some indications that they should be chosen as nonlinear functions, as long as we have no further knowledge about the target device we define them linearly:
2662 % \begin{align}
2663 % \emph{UCR}_c(k) &:= \beta_c\cdot k\\
2664 % \emph{UCR}_m(k) &:= \beta_m\cdot k\\
2665 % \emph{UCR}_y(k) &:= \beta_y\cdot k\\
2666 % \emph{BG}(k) &:= \beta_k\cdot k
2667 % \end{align}
2668 % \DescribeMacro\adjustUCRBG
2669 % where the parameters are given by |\def\adjustUCRBG{|\Meta{$\beta_c$},\Meta{$\beta_m$},\Meta{$\beta_y$},\Meta{$\beta_k$}|}| at any point in a document, defaulting to |{|$\adjustUCRBG$|}|.
2670 %
2671 %
2672 % \paragraph{Conversion \Model{cmy} to \Model{gray}}
2673 % This is derived from the conversion chain $\Model{cmy}\to\Model{rgb}\to\Model{gray}$.
2674 % \begin{align}
2675 % \emph{gray} & := 1 - (0.3\cdot\emph{cyan} + 0.59\cdot\emph{magenta} + 0.11\cdot\emph{yellow})
2676 % \end{align}
2677 %
2678 %
2679 % \paragraph{Complement of \Model{cmy} color}
2680 % We simply take the complementary vector:
2681 % \begin{gather}
2682 % (\emph{cyan}^*, \emph{magenta}^*, \emph{yellow}^*) := E - (\emph{cyan}, \emph{magenta}, \emph{yellow})
2683 % \end{gather}
2684 %
2685 %
2686 % \subsubsection{The \Model{cmyk} model}
2687 %
2688 % \paragraph{Conversion \Model{cmyk} to \Model{cmy}}\label{sec.cmyk2cmy}
2689 % Based on \cite{plrm}, p. 477, in connection with $\Model{rgb}\to\Model{cmy}$ conversion.
2690 % \begin{align}
2691 % \emph{cyan} & := \min\{1,\emph{cyan} + \emph{black}\}\\
2692 % \emph{magenta} & := \min\{1,\emph{magenta} + \emph{black}\}\\
2693 % \emph{yellow} & := \min\{1,\emph{yellow} + \emph{black}\}
2694 % \end{align}
2695 %
2696 %
2697 % \paragraph{Conversion \Model{cmyk} to \Model{gray}}
2698 % Source: \cite{plrm}, p. 475.
2699 % \begin{align}
2700 % \emph{gray} & := 1 - \min\{1,0.3\cdot\emph{cyan} + 0.59\cdot\emph{magenta} + 0.11\cdot\emph{yellow} + black\}
2701 % \end{align}
2702 %
2703 %
2704 % \paragraph{Complement of \Model{cmyk} color}
2705 % The simple vector complement does not yield useful results.
2706 % Therefore, we first convert %$C=(\emph{cyan}, \emph{magenta}, \emph{yellow}, \emph{black})$
2707 % to the \Model{cmy} model, calculate the complement there, and convert back to \Model{cmyk}.
2708 %
2709 %
2710 % \subsubsection{The \Model{hsb} model}
2711 %
2712 % \paragraph{Conversion \Model{hsb} to \Model{rgb}}
2713 % \begin{gather}
2714 % (\emph{red},\emph{green},\emph{blue}) :=
2715 % \emph{brightness}\cdot( E - \emph{saturation}\cdot F)\\
2716 % \intertext{with}
2717 % i := \left\lfloor 6\cdot\emph{hue}\right\rfloor,\qquad f := 6\cdot\emph{hue} - i\\
2718 % \intertext{and}
2719 % F :=
2720 % \begin{cases}
2721 % (0,1-f,1) & \text{if $i=0$}\\
2722 % (f,0,1) & \text{if $i=1$}\\
2723 % (1,0,1-f) & \text{if $i=2$}\\
2724 % (1,f,0) & \text{if $i=3$}\\
2725 % (1-f,1,0) & \text{if $i=4$}\\
2726 % (0,1,f) & \text{if $i=5$}\\
2727 % (0,1,1) & \text{if $i=6$}
2728 % \end{cases}\label{eq.hsb2rgb2}
2729 % \end{gather}
2730 %
2731 % \medskip
2732 %
2733 % This is based on \cite{smith}, \emph{HSV to RGB Algorithm (Hexcone Model)}, which reads (slightly reformulated):
2734 % \begin{align}
2735 % m & := 1-\emph{saturation}\\
2736 % n & := 1-f\cdot\emph{saturation}\\
2737 % k & := 1-(1-f)\cdot\emph{saturation}\\
2738 % (\emph{red},\emph{green},\emph{blue}) & := \emph{brightness}\cdot
2739 % \begin{cases}
2740 % (1,k,m) & \text{if $i=0,6$}\\
2741 % (n,1,m) & \text{if $i=1$}\\
2742 % (m,1,k) & \text{if $i=2$}\\
2743 % (m,n,1) & \text{if $i=3$}\\
2744 % (k,m,1) & \text{if $i=4$}\\
2745 % (1,m,n) & \text{if $i=5$}
2746 % \end{cases}\label{eq.hsb2rgb1}
2747 % \end{align}
2748 % Note that the case $i=6$ (which results from $\emph{hue}=1$) is missing in Smith's algorithm.
2749 % Because of
2750 % \begin{align}
2751 % \lim_{f\to1} (0,1,f) = (0,1,1) = \lim_{f\to0} (0,1-f,1)
2752 % \end{align}
2753 % it is clear that there is only one way to define $F$ for $i=6$ in order to get a continuous function, as shown in equation (\ref{eq.hsb2rgb2}).
2754 % This has been transformed back to equation (\ref{eq.hsb2rgb1}).
2755 % A similar argument shows that $F$ indeed is a continuous function of \emph{hue} over the whole range $[0,1]$.
2756 %
2757 %
2758 % \paragraph{Conversion \Model{hsb} to \Model{Hsb}}
2759 % Only the first component has to be changed.
2760 % \begin{gather}
2761 % (\emph{hue\Circ}, \emph{saturation}, \emph{brightness}) := (H\cdot\emph{hue}, \emph{saturation}, \emph{brightness})
2762 % \end{gather}
2763 %
2764 %
2765 % \paragraph{Conversion \Model{hsb} to \Model{HSB}}
2766 % As described in section \vref{sec.real2int}.
2767 % \begin{gather}
2768 % (\emph{Hue}, \emph{Saturation}, \emph{Brightness}) := \bigl(\RtoI M(\emph{hue}), \RtoI M(\emph{saturation}), \RtoI M(\emph{brightness})\bigr)
2769 % \end{gather}
2770 %
2771 %
2772 % \paragraph{Complement of \Model{hsb} color}
2773 % We have not found a formula in the literature, therefore we give a short proof afterwards.
2774 % \begin{lemma}
2775 % The \textup{\Model{hsb}}-complement can be calculated by the following formulas:\em
2776 % \begin{align}
2777 % \emph{hue}^* & :=
2778 % \begin{cases}
2779 % \emph{hue} + \frac12 & \text{if $\emph{hue}<\frac12$}\\[1ex]
2780 % \emph{hue} - \frac12 & \text{if $\emph{hue}\ge\frac12$}\\
2781 % \end{cases}\\[1ex]
2782 % \emph{brightness}^* & := 1 - \emph{brightness}\cdot(1-\emph{saturation})\\[1ex]
2783 % \emph{saturation}^* & :=
2784 % \begin{cases}
2785 % 0 & \text{if $\emph{brightness}^*=0$}\\[1ex]
2786 % \displaystyle\frac{\emph{brightness}\cdot\emph{saturation}}{\emph{brightness}^*} & \text{if $\emph{brightness}^*\ne0$}
2787 % \end{cases}
2788 % \end{align}
2789 % \end{lemma}
2790 %
2791 % \begin{proof}
2792 % Starting with the original color $C=(h,s,b)$, we define color $C^*=(h^*,s^*,b^*)$ by the given formulas, convert both $C$ and $C^*$ to the \Model{rgb} model and show that
2793 % \begin{gather}
2794 % C_{\Model{rgb}} + C_{\Model{rgb}}^* = b\cdot(E - s\cdot F) + b^*\cdot(E - s'\cdot F^*) \stackrel!= E,\label{eq.hsbcompl1}
2795 % \end{gather}
2796 % which means that $C_{\Model{rgb}}$ is the complement of $C_{\Model{rgb}}^*$.
2797 % First we note that the parameters of $C^*$ are in the legal range $[0,1]$.
2798 % This is obvious for $h^*,b^*$.
2799 % From
2800 % $b^* = 1-b\cdot(1-s) = 1 - b + b\cdot s$
2801 % we derive $b\cdot s = b^* - (1-b) \le b^*$, therefore $s^*\in[0,1]$, and
2802 % \begin{gather*}
2803 % b^* = 0 \Leftrightarrow s=0 \text{ and } b=1.
2804 % \end{gather*}
2805 % Thus, equation (\ref{eq.hsbcompl1}) holds in the case $b^*=0$.
2806 % Now we assume $b^*\ne0$, hence
2807 % \begin{align*}
2808 % C_{\Model{rgb}} + C_{\Model{rgb}}^*
2809 % &= b\cdot(E - s\cdot F) + b^*\cdot\Bigl(E - \frac{b\cdot s}{b^*}\cdot F^*\Bigr) \\
2810 % &= b\cdot E - b\cdot s\cdot F + b^*\cdot E - b\cdot s\cdot F^*\\[1ex]
2811 % &= E - b\cdot s\cdot(F+F^*-E)
2812 % \end{align*}
2813 % since $b^*=1-b+bs$.
2814 % Therefore, it is sufficient to show that
2815 % \begin{gather}
2816 % F+F^*=E.\label{eq.hsbcompl2}
2817 % \end{gather}
2818 % From
2819 % \begin{gather*}\textstyle
2820 % h<\frac12 \Rightarrow h^*=h+\frac12 \Rightarrow 6h^* = 6h+3 \Rightarrow i^*=i+3 \text{ and } f^*=f
2821 % \end{gather*}
2822 % it is easy to see from (\ref{eq.hsb2rgb2}) that equation (\ref{eq.hsbcompl2}) holds for the cases $i=0,1,2$.
2823 % Similarly,
2824 % \begin{gather*}\textstyle
2825 % h\ge\frac12 \Rightarrow h^*=h-\frac12 \Rightarrow 6h^* = 6h-3 \Rightarrow i^*=i-3 \text{ and } f^*=f
2826 % \end{gather*}
2827 % and again from (\ref{eq.hsb2rgb2}) we derive (\ref{eq.hsbcompl2}) for the cases $i=3,4,5$.
2828 % Finally, if $i=6$ then $f=0$ and $F+F^* = (0,1,1) + (1,0,0) = E$.
2829 % \end{proof}
2830 %
2831 %
2832 % \subsubsection{The \Model{Hsb} model}
2833 %
2834 % \paragraph{Conversion \Model{Hsb} to \Model{hsb}}
2835 % Only the first component has to be changed.
2836 % \begin{gather}
2837 % (\emph{hue}, \emph{saturation}, \emph{brightness}) := (\emph{hue\Circ}/H, \emph{saturation}, \emph{brightness})
2838 % \end{gather}
2839 %
2840 %
2841 % \paragraph{Conversion \Model{Hsb} to \Model{tHsb}}
2842 % Under the settings of (\ref{eq.tHsb1})--(\ref{eq.tHsb3}) we simply have to exchange the letters $x$ and $y$ in equation (\ref{eq.tHsb4}) to get the inverse transformation:
2843 % \begin{gather}
2844 % \displaystyle \emph{hue\Circ}\in\left[y_{\eta-1},y_\eta\right] \Rightarrow
2845 % \emph{hue\Circ} := x_{\eta-1} + \frac{x_\eta - x_{\eta-1}}{y_\eta - y_{\eta-1}}\cdot(\emph{hue\Circ} - y_{\eta-1})
2846 % \end{gather}
2847 % while \emph{saturation} and \emph{brightness} are left unchanged.
2848 %
2849 %
2850 % \subsubsection{The \Model{tHsb} model}
2851 %
2852 % \paragraph{Conversion \Model{tHsb} to \Model{Hsb}}\label{sec.tHsb2Hsb}
2853 % \DescribeMacro\rangeHsb
2854 % \DescribeMacro\rangetHsb
2855 % We assume that $\texttt{\string\rangeHsb}=H$ and |\rangetHsb| expands to
2856 % \begin{gather}
2857 % x_1,y_1;x_2,y_2;\dots;x_{h-1},y_{h-1}\label{eq.tHsb1}
2858 % \intertext{where}
2859 % x_0:=0<x_1<x_2<\dots<x_{h-1}<x_h:=H\label{eq.tHsb2}\\
2860 % y_0:=0<y_1<y_2<\dots<y_{h-1}<y_h:=H\label{eq.tHsb3}
2861 % \end{gather}
2862 % with an integer $h>0$.
2863 % Now the $x$ and $y$ values determine a piecewise linear transformation:
2864 % \begin{gather}
2865 % \displaystyle \emph{hue\Circ}\in\left[x_{\eta-1},x_\eta\right] \Rightarrow
2866 % \emph{hue\Circ} := y_{\eta-1} + \frac{y_\eta - y_{\eta-1}}{x_\eta - x_{\eta-1}}\cdot(\emph{hue\Circ} - x_{\eta-1})
2867 % \label{eq.tHsb4}
2868 % \end{gather}
2869 % while \emph{saturation} and \emph{brightness} are left unchanged.
2870 %
2871 %
2872 % \subsubsection{The \Model{gray} model}
2873 %
2874 % \paragraph{Conversion \Model{gray} to \Model{rgb}}
2875 % Source: \cite{plrm}, p. 474.
2876 % \begin{gather}
2877 % (\emph{red}, \emph{green}, \emph{blue}) := \emph{gray}\cdot E
2878 % \end{gather}
2879 %
2880 %
2881 % \paragraph{Conversion \Model{gray} to \Model{cmy}}
2882 % This is derived from the conversion chain $\Model{gray}\to\Model{rgb}\to\Model{cmy}$.
2883 % \begin{gather}
2884 % (\emph{cyan}, \emph{magenta}, \emph{yellow}) := (1-\emph{gray})\cdot E
2885 % \end{gather}
2886 %
2887 %
2888 % \paragraph{Conversion \Model{gray} to \Model{cmyk}}
2889 % Source: \cite{plrm}, p. 475.
2890 % \begin{gather}
2891 % (\emph{cyan}, \emph{magenta}, \emph{yellow}, \emph{black}) := (0,0,0,1-\emph{gray})
2892 % \end{gather}
2893 %
2894 %
2895 % \paragraph{Conversion \Model{gray} to \Model{hsb}}
2896 % This is derived from the conversion chain $\Model{gray}\to\Model{rgb}\to\Model{hsb}$.
2897 % \begin{gather}
2898 % (\emph{hue}, \emph{saturation}, \emph{brightness}) := (0,0,\emph{gray})
2899 % \end{gather}
2900 %
2901 %
2902 % \paragraph{Conversion \Model{gray} to \Model{Hsb}/\Model{tHsb}}
2903 % This is derived from the conversion chain $\Model{gray}\to\Model{hsb}\to\Model{Hsb}$, followed by $\Model{Hsb}\to\Model{tHsb}$ if applicable.
2904 % \begin{gather}
2905 % (\emph{hue\Circ}, \emph{saturation}, \emph{brightness}) := (0,0,\emph{gray})
2906 % \end{gather}
2907 %
2908 %
2909 % \paragraph{Conversion \Model{gray} to \Model{Gray}}
2910 % As described in section \vref{sec.real2int}.
2911 % \begin{gather}
2912 % \emph{Gray} := \RtoI N(\emph{gray})
2913 % \end{gather}
2914 %
2915 %
2916 % \paragraph{Complement of \Model{gray} color}
2917 % This is similar to the \Model{rgb} case:
2918 % \begin{gather}
2919 % \emph{gray}^* := 1 - \emph{gray}
2920 % \end{gather}
2921 %
2922 %
2923 % \subsubsection{The \Model{RGB} model}
2924 %
2925 % \paragraph{Conversion \Model{RGB} to \Model{rgb}}
2926 % As described in section \vref{sec.int2real}.
2927 % \begin{gather}
2928 % (\emph{red}, \emph{green}, \emph{blue}) := \bigl(\ItoR L(\emph{Red}), \ItoR L(\emph{Green}), \ItoR L(\emph{Blue})\bigr)
2929 % \end{gather}
2930 %
2931 %
2932 % \subsubsection{The \Model{HTML} model}
2933 %
2934 % \paragraph{Conversion \Model{HTML} to \Model{rgb}}
2935 % As described in section \vref{sec.int2real}: starting with \emph{RRGGBB} set
2936 % \begin{gather}
2937 % (\emph{red}, \emph{green}, \emph{blue}) := \bigl(\ItoR{255}(\emph{RR}_{\emph{dec}}), \ItoR{255}(\emph{GG}_{\emph{dec}}), \ItoR{255}(\emph{BB}_{\emph{dec}})\bigr)
2938 % \end{gather}
2939 %
2940 %
2941 % \subsubsection{The \Model{HSB} model}
2942 %
2943 % \paragraph{Conversion \Model{HSB} to \Model{hsb}}
2944 % As described in section \vref{sec.int2real}.
2945 % \begin{gather}
2946 % (\emph{hue}, \emph{saturation}, \emph{brightness}) := \bigl(\ItoR M(\emph{Hue}), \ItoR M(\emph{Saturation}), \ItoR M(\emph{Brightness})\bigr)
2947 % \end{gather}
2948 %
2949 %
2950 % \subsubsection{The \Model{Gray} model}
2951 %
2952 % \paragraph{Conversion \Model{Gray} to \Model{gray}}
2953 % As described in section \vref{sec.int2real}.
2954 % \begin{gather}
2955 % \emph{gray} := \ItoR N(\emph{Gray})
2956 % \end{gather}
2957 %
2958 %
2959 % \subsubsection{The \Model{wave} model}
2960 %
2961 % \paragraph{Conversion \Model{wave} to \Model{rgb}}
2962 % Source: based on \People{Dan}{Bruton}'s algorithm \cite{Bruton}.
2963 % Let $\lambda$ be a visible wavelength, given in nanometers (nm), i.e., $\lambda\in\left[380,780\right]$.
2964 % We assume further that $\gamma>0$ is a fixed number ($\gamma=0.8$ in \cite{Bruton}).
2965 % First set
2966 % \begin{align}
2967 % (r,g,b) & :=
2968 % \begin{cases}
2969 % \displaystyle \Bigl(\frac{440-\lambda}{440-380},0,1\Bigr) & \text{if $\lambda\in[380,440[$}\\[1.75ex]
2970 % \displaystyle \Bigl(0,\frac{\lambda-440}{490-440},1\Bigr) & \text{if $\lambda\in[440,490[$}\\[1.75ex]
2971 % \displaystyle \Bigl(0,1,\frac{510-\lambda}{510-490}\Bigr) & \text{if $\lambda\in[490,510[$}\\[1.75ex]
2972 % \displaystyle \Bigl(\frac{\lambda-510}{580-510},1,0\Bigr) & \text{if $\lambda\in[510,580[$}\\[1.75ex]
2973 % \displaystyle \Bigl(1,\frac{645-\lambda}{645-580},0\Bigr) & \text{if $\lambda\in[580,645[$}\\[2.5ex]
2974 % \displaystyle (1,0,0) & \text{if $\lambda\in[645,780]$}\\
2975 % \end{cases}\label{eq.gamma2rgb1}\\
2976 % \intertext{then, in order to let the intensity fall off near the vision limits,}
2977 % f & :=
2978 % \begin{cases}
2979 % \displaystyle 0.3 + 0.7\cdot\frac{\lambda-380}{420-380} & \text{if $\lambda\in\left[380,420\right[$}\\[1.25ex]
2980 % \displaystyle 1 & \text{if $\lambda\in[420,700]$}\\[1ex]
2981 % \displaystyle 0.3 + 0.7\cdot\frac{780-\lambda}{780-700} & \text{if $\lambda\in\left]700,780\right]$}\\
2982 % \end{cases}\label{eq.gamma2rgb2}\\
2983 % \intertext{and finally}
2984 % (\emph{red},\emph{green},\emph{blue}) & := \bigl((f\cdot r)^\gamma, (f\cdot g)^\gamma, (f\cdot b)^\gamma\bigr)
2985 % \end{align}
2986 % The intermediate colors $(r,g,b)$ at the interval borders of equation (\ref{eq.gamma2rgb1}) are well-known:
2987 % for $\lambda=380,440,490,510,580,645$ we get \Color{magenta}, \Color{blue}, \Color{cyan}, \Color{green}, \Color{yellow}, \Color{red}, respectively.
2988 % These turn out to be represented in the \Model{hsb} model by $\emph{hue}=\frac56,\frac46,\frac36,\frac26,\frac16,\frac06$, whereas $\emph{saturation}=\emph{brightness}=1$ throughout the 6~colors.
2989 % Furthermore, these \Model{hsb} representations are independent of the actual $\gamma$ value.
2990 % Staying within this model framework, we observe that the intensity fall off near the vision limits --- as represented by equation (\ref{eq.gamma2rgb2}) --- translates into decreasing \emph{brightness} parameters towards the margins.
2991 % A simple calculation shows that the edges $\lambda=380,780$ of the algorithm yield the colors |magenta!|$0.3^\gamma$|!black|, |red!|$0.3^\gamma$|!black|, respectively.
2992 % We see no reason why we should not extend these edges in a similar fashion to end-up with true \Color{black} on either side.
2993 % Now we are prepared to translate everything into another, more natural algorithm.
2994 %
2995 %
2996 % \paragraph{Conversion \Model{wave} to \Model{hsb}}
2997 % Let $\lambda>0$ be a wavelength, given in nanometers (nm), and let
2998 % \begin{gather}
2999 % \varrho : \bbbR \to \left[0,1\right],\ x \mapsto \bigl( \min\{ 1, \max\{ 0,x\} \} )^\gamma
3000 % \end{gather}
3001 % with a fixed correction number $\gamma>0$.
3002 % Then
3003 % \begin{align}
3004 % \emph{hue} & := \displaystyle \frac16\cdot
3005 % \begin{cases}
3006 % \displaystyle 4 + \varrho\Bigl(\frac{\lambda-440}{380-440}\Bigr) & \text{if $\lambda<440$}\\[1.75ex]
3007 % \displaystyle 4 - \varrho\Bigl(\frac{\lambda-440}{490-440}\Bigr) & \text{if $\lambda\in[440,490[$}\\[1.75ex]
3008 % \displaystyle 2 + \varrho\Bigl(\frac{\lambda-510}{490-510}\Bigr) & \text{if $\lambda\in[490,510[$}\\[1.75ex]
3009 % \displaystyle 2 - \varrho\Bigl(\frac{\lambda-510}{580-510}\Bigr) & \text{if $\lambda\in[510,580[$}\\[1.75ex]
3010 % \displaystyle 0 + \varrho\Bigl(\frac{\lambda-645}{580-645}\Bigr) & \text{if $\lambda\in[580,645[$}\\[2.5ex]
3011 % \displaystyle 0 & \text{if $\lambda\ge645$}\\
3012 % \end{cases}\label{eq.gamma2hsb1}\\[1ex]
3013 % \emph{saturation} & := 1\\[1ex]
3014 % \emph{brightness} & :=
3015 % \begin{cases}
3016 % \displaystyle \varrho\Bigl(0.3 + 0.7\cdot\frac{\lambda-380}{420-380}\Bigr) & \text{if $\lambda<420$}\\[1.5ex]
3017 % \displaystyle 1 & \text{if $\lambda\in[420,700]$}\\[1ex]
3018 % \displaystyle \varrho\Bigl(0.3 + 0.7\cdot\frac{\lambda-780}{700-780}\Bigr) & \text{if $\lambda>700$}\\
3019 % \end{cases}\label{eq.gamma2hsb2}
3020 % \end{align}
3021 % For the sake of completeness we note that, independent of $\gamma$,
3022 % \begin{gather*}
3023 % (\emph{hue},\emph{saturation},\emph{brightness}) =
3024 % \begin{cases}
3025 % \bigl(\frac56,1,0\bigr) & \text{if $\lambda\le 380 - \frac{3\cdot(420-380)}7 = 362.857\dots$}\\[1.5ex]
3026 % \bigl(0,1,0\bigr) & \text{if $\lambda\ge 780 + \frac{3\cdot(780-700)}7 = 814.285\dots$}\\
3027 % \end{cases}\label{eq.gamma2hsb3}
3028 % \end{gather*}
3029 % What is the best (or, at least, a good) value for $\gamma$?
3030 % In the original algorithm \cite{Bruton}, $\gamma=0.8$ is chosen.
3031 % However, we could not detect significant visible difference between the cases $\gamma=0.8$ and $\gamma=1$.
3032 % Thus, for the time being, \XC's implementation uses the latter value which implies a pure linear approach.
3033 % In the \Package{pstricks} examples file \href{xcolor2.pdf}{\File{xcolor2.tex}}, there is a demonstration of different $\gamma$ values.
3034 %
3035 % \clearpage
3036 %
3037 %
3038 %
3039 % \begin{adjustwidth}{-2.5cm}{}
3040 % \begingroup\raggedright
3041 % \begin{thebibliography}{00}
3042 % \addcontentsline{toc}{section}{References}
3043 %
3044 % \bibitem{plrm}%
3045 % {Adobe Systems Incorporated: ``PostScript Language Reference Manual''. Addison-Wesley, third edition, 1999.
3046 % \URL{http://www.adobe.com/products/postscript/pdfs/PLRM.pdf}}
3047 %
3048 % \bibitem{fbox}%
3049 % {\People{Donald}{Arseneau}: ``Patch so \cmd\fbox{} draws frame on top of text''. \LaTeX{} bug report, latex/3655, 2004/03/18.
3050 % \URL{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/3655}}
3051 %
3052 % \bibitem{url}%
3053 % {\People{Donald}{Arseneau}: \Package{url} package, ``2005/06/27 ver 3.2 Verb mode for urls, etc.''.
3054 % \CTAN{macros/latex/contrib/misc/}{url.sty}}
3055 %
3056 % \bibitem{Bruton}%
3057 % {\People{Dan}{Bruton}: ``Approximate RGB values for Visible Wavelengths'', 1996.
3058 % \URL{http://www.physics.sfasu.edu/astro/color/spectra.html}}
3059 %
3060 % \bibitem{dpc}%
3061 % {\People{David P.}{Carlisle}: ``Packages in the `graphics' bundle'', 2014.
3062 % \CTAN{macros/latex/required/graphics/}{grfguide.*}}
3063 %
3064 % \bibitem{color}%
3065 % {\People{David P.}{Carlisle}: \LCP, ``2016/01/03 v1.1b Standard LaTeX Color (DPC)''.
3066 % \CTAN{macros/latex/required/graphics/}{color.dtx}}
3067 %
3068 % \bibitem{colortbl}%
3069 % {\People{David P.}{Carlisle}: \Package{colortbl} package, ``2001/02/13 v0.1j Color table columns''.
3070 % \CTAN{macros/latex/contrib/colortbl/}{}}
3071 %
3072 % \bibitem{pstcol}%
3073 % {\People{David P.}{Carlisle}, \People{Herbert}{Vo\ss}, \People{Rolf}{Niepraschk}: \Package{pstcol} package, ``2005/11/16 v1.2 LaTeX wrapper for `PSTricks'{}''.
3074 % \CTAN{macros/graphics/pstricks/latex/}{pstcol.sty}}
3075 %
3076 % \bibitem{chroma}%
3077 % {\People{Uwe}{Kern}: ``Chroma: a reference book of \LaTeX{} colors''.
3078 % \CTAN{info/colour/chroma/}{} and
3079 % \URL{http://www.ukern.de/tex/chroma.html}}
3080 %
3081 % \bibitem{xcolor}%
3082 % {\People{Uwe}{Kern}: \Package{xcolor} package, ``\LaTeX{} color extensions''.
3083 % \CTAN{macros/latex/contrib/xcolor/}{} and
3084 % \URL{http://www.ukern.de/tex/xcolor.html}}
3085 %
3086 % \bibitem{mik}%
3087 % {MiK\TeX{} Project:
3088 % \URL{http://www.miktex.org/}}
3089 %
3090 % \bibitem{colorinfo}%
3091 % {\People{Rolf}{Niepraschk}: \Package{colorinfo} package, ``2003/05/04 v0.3c Info from defined colors''.
3092 % \CTAN{macros/latex/contrib/colorinfo/}{}}
3093 %
3094 % \bibitem{pdfcolmk}%
3095 % {\People{Heiko}{Oberdiek}: \Package{pdfcolmk} package, ``2006/02/20 v0.8 PDFtex COLor MarK''.
3096 % \CTAN{macros/latex/contrib/oberdiek/}{pdfcolmk.*}}
3097 %
3098 % \bibitem{hyperref}%
3099 % {\People{Sebastian}{Rahtz}, \People{Heiko}{Oberdiek}: \Package{hyperref} package, ``2006/09/06 v6.75e Hypertext links for \LaTeX''.
3100 % \CTAN{macros/latex/contrib/hyperref/}{}}
3101 %
3102 % \bibitem{smith}%
3103 % {\People{Alvy Ray}{Smith}: ``Color Gamut Transform Pairs''. \emph{Computer Graphics} (ACM SIGGRAPH), Volume 12, Number 3, August 1978.
3104 % \URL{http://alvyray.com/Papers/PapersCG.htm}}
3105 %
3106 % \bibitem{HTML4}%
3107 % {World Wide Web Consortium: ``HTML4 color keywords''.
3108 % \URL{http://www.w3.org/TR/css3-color/\#html4}}
3109 %
3110 % \bibitem{svg}%
3111 % {World Wide Web Consortium: ``Scalable Vector Graphics (\Index{SVG}) 1.1 Specification --- Basic Data Types and Interfaces''.
3112 % \URL{http://www.w3.org/TR/SVG11/types.html\#ColorKeywords}}
3113 %
3114 % \end{thebibliography}
3115 % \endgroup
3116 % \clearpage
3117 %
3118 % \columnsep2.25em
3119 % \begin{multicols}{2}[\section*{Appendix}%
3120 % \addcontentsline{toc}{section}{Appendix}]
3121 %
3122 % \subsection*{Acknowledgement}
3123 % \addcontentsline{toc}{subsection}{Acknowledgement}
3124 % This package is based on and contains code copied from \cite{color} (Copyright (C) 1994--1999 \People{David P.}{Carlisle}), which is part of the Standard \LaTeX{} `Graphics Bundle'.
3125 % Although many commands and features have been added and most of the original \LC{} commands have been rewritten or adapted within \XC, the latter package would not exist without \LC.
3126 % Thus, the author is grateful to \People{David P.}{Carlisle} for having created \LC{} and its accompanying files.
3127 %
3128 % \subsection*{Trademarks}
3129 % \addcontentsline{toc}{subsection}{Trademarks}
3130 % Trademarks appear throughout this documentation without any trademark symbol; they are the property of their respective trademark owner.
3131 % There is no intention of infringement; the usage is to the benefit of the trademark owner.
3132 %
3133 % \raggedright
3134 % \leftmargini1em
3135 % \leftmarginii1em
3136 % \leftmarginiii1em
3137 %
3138 % \subsection*{Known Issues}
3139 % \addcontentsline{toc}{subsection}{Known Issues}
3140 % \begin{itemize}
3141 % \item |\rowcolors[\hline]...| does not work with \Package{longtable}.
3142 % \end{itemize}
3143 %
3144 % \subsection*{History}
3145 % \addcontentsline{toc}{subsection}{History}
3146 % \subsubsection*{2023/11/15 v3.01}
3147 % \begin{itemize}
3148 % \item only warn and not error if obsolete option usenames is used (issue \#31)
3149 % \end{itemize}
3150 % \subsubsection*{2023/11/11 v3.00}
3151 % \begin{itemize}
3152 % \item if a \LaTeX{} older than 2022-06-01 is detected a frozen version is used.
3153 % All new features apply only if LaTeX 2022-06-01 or newer is detected.
3154 % The frozen version can also be requested with \verb+\usepackage{xcolor}[=v2]+
3155 % \item The new LaTeX key/val handler is used for the package options.
3156 % That means there will be fewer option clash errors (issue \#29).
3157 % item The |\rowcolors| command has moved to the |colortbl| package and is no longer
3158 % defined by |xcolor|.
3159 % \item The fixpdftex option is obsolete and does nothing at all (issue \#20)
3160 % \item Extended |\normalcolor| to set also the dot color, issue \#19
3161 % \item Fix Gray color model, issue \#23
3162 % \end{itemize}
3163 %
3164 % \subsubsection*{2022/06/12 v2.14}
3165 % \begin{itemize}
3166 % \item Load code from \LaTeX\ to define |\mathcolor| if it is available.
3167 % \item Bug fixes:
3168 % \begin{itemize}
3169 % \item Modify |\XC@info| to avoid spurious error from |\colorlet{foo}{}|, issue \#12
3170 % \item make |\normalcolor|, |\colorbox|, |\fcolorbox|, |\textcolor|, |\pagecolor|,
3171 % |\nopagecolor|, |\definecolor|, |\DefineNamedColor|
3172 % protected as in |color.sty|, issue \#17
3173 % \end{itemize}
3174 % \end{itemize}
3175
3176 % \subsubsection*{2021/10/31 v2.13}
3177 % \begin{itemize}
3178 % \item Bug Fixes:
3179 % \begin{itemize}
3180 % \item Avoid use of |\string| to generate csnames
3181 % \item Declare |dvisvgm| option and make |dvipdfm| an alias to |dvipdfmx| to match graphics and color packages.
3182 % \item Modify |\XC@info| to avoid spurious text from |\colorlet{foo}{.!50}|
3183 % \end{itemize}
3184 % \end{itemize}
3185 %
3186 % \subsubsection*{2016/05/11 v2.12}
3187 % \begin{itemize}
3188 % \item New features:
3189 % \begin{itemize}
3190 % \item |\nopagecolor| command as introduced in \LC{} v1.1a (example added to \File{xcolor3.tex});
3191 % \item \Option{luatex} driver option (code provided by DPC) to fix incompatibilities due to changes in new Lua\TeX\ version.
3192 % \end{itemize}
3193 % \item Bugfixes:
3194 % \begin{itemize}
3195 % \item possible name conflict by |\XC@ifxcase| call;
3196 % \item incorrect internal |\@hex@@Hex| macro.
3197 % \end{itemize}
3198 % \end{itemize}
3199 %
3200 % \subsubsection*{2007/01/21 v2.11}
3201 % \begin{itemize}
3202 % \item New features:
3203 % \begin{itemize}
3204 % \item color names \Color{lime} and \Color{teal} added to the set of predefined colors.
3205 % \end{itemize}
3206 % \item Bugfix:
3207 % \begin{itemize}
3208 % \item incorrect |\XC@strip@comma| call within \Package{hyperref}-related options.
3209 % \end{itemize}
3210 % \end{itemize}
3211 %
3212 % \subsubsection*{2006/11/28 v2.10}
3213 % \begin{itemize}
3214 % \item New features:
3215 % \begin{itemize}
3216 % \item \Option{fixinclude} option prevents \Program{dvips} from explicitly resetting current color to \Color{black} before actually inserting an \File{.eps} file via |\color{red}\includegraphics{foo}|.
3217 % \end{itemize}
3218 % \item Changes:
3219 % \begin{itemize}
3220 % \item |\colorbox| and |\fcolorbox| made robust;
3221 % \item obsolete package option \oOption{pst} removed;
3222 % \item several changes to internal macros.
3223 % \end{itemize}
3224 % \item Bugfixes:
3225 % \begin{itemize}
3226 % \item incorrect processing of \Model{cmyk}-type current color `.'.
3227 % \end{itemize}
3228 % \end{itemize}
3229 %
3230 % \subsubsection*{2005/12/21 v2.09}
3231 % \begin{itemize}
3232 % \item New features:
3233 % \begin{itemize}
3234 % \item |\definecolor| and |\color| now accept space-separated color specifications, e.g., |\color| |[rgb]{1 .5 0}|;
3235 % \item experimental \Option{xcdraw} option extended to \Option{pdftex} and \Option{dvipdfm} drivers.
3236 % \end{itemize}
3237 % \item Changes:
3238 % \begin{itemize}
3239 % \item test file \File{xcolor2.tex} made compatible with recent changes in \Package{pstricks};
3240 % \item test file \File{xcolor3.tex} extended;
3241 % \item driver test file \File{xcolor4.tex} extended to demonstrate the different frame drawing approaches;
3242 % \item more efficient implementation of driver-specific code.
3243 % \end{itemize}
3244 % \end{itemize}
3245 %
3246 % \subsubsection*{2005/11/25 v2.08}
3247 % \begin{itemize}
3248 % \item New features:
3249 % \begin{itemize}
3250 % \item more flexibility for |\fcolorbox| arguments, e.g., |\fcolorbox| |[gray]{0.5}[wave]{580}{test}|;
3251 % \item |\boxframe| returns a frame of given dimensions;
3252 % \item new implementation of |\f(rame)box| and |\fcolorbox| as an extension of bug report latex/3655 to reduce pixel positioning errors in output devices;
3253 % \item \Option{kernelfbox} option for those who prefer the previous |\f(rame)box| approach;
3254 % \item experimental \Option{xcdraw} option uses \Index{PostScript} commands to draw frames and color boxes in case of \Option{dvips}.
3255 % \end{itemize}
3256 % \item Bugfixes:
3257 % \begin{itemize}
3258 % \item insufficient expression type detection within |\colorlet|;
3259 % \item wrong calculation in the unit interval reduction for negative integers (affecting color series and extended color expressions).
3260 % \end{itemize}
3261 % \end{itemize}
3262 %
3263 % \subsubsection*{2005/11/12 v2.07}
3264 % \begin{itemize}
3265 % \item New features:
3266 % \begin{itemize}
3267 % \item color model \Model{Hsb} allows to specify \emph{hue} in degrees;
3268 % \item color model \Model{tHsb} (\pModel{tuned} \Model{Hsb}) for user-defined \emph{hue} configuration on color wheels;
3269 % \item easy generation of color harmonies derived from \Model{Hsb} or \Model{tHsb} color wheels, e.g., |\color{red>wheel,1,12}| yields an `analogous' color to \Color{red} on a 12-spoke wheel;
3270 % \item additional 317 predefined color names according to \File{rgb.txt}, which is part of \Index{Unix}/\Index{X11} distributions;
3271 % \item \Option{svgnames} option extended by~4~colors taken from \File{rgb.txt};
3272 % \item enhanced syntax for immediate conversion, e.g., |\definecolor| |{foo}{rgb:gray}{0.3}| or |\color| |[rgb:wave]{478}|;
3273 % \item |\@ifundefinedcolor| and |\@ifundefinedmodel| commands;
3274 % \end{itemize}
3275 % \item Changes:
3276 % \begin{itemize}
3277 % \item enhanced documentation;
3278 % \item several changes to internal macros.
3279 % \end{itemize}
3280 % \item Bugfixes:
3281 % \begin{itemize}
3282 % \item wrong calculation of color series components in some cases of negative step parameters.
3283 % \end{itemize}
3284 % \end{itemize}
3285 %
3286 % \subsubsection*{2005/10/15 v2.06}
3287 % \begin{itemize}
3288 % \item New features:
3289 % \begin{itemize}
3290 % \item color model \Model{wave} for (approximate) visualisation of light wavelengths, still somewhat experimental;
3291 % \item pseudo-model \nModel{ps} for colors defined by literal \Index{PostScript} code in conjunction with \Package{pstricks} and \Option{dvips}; an illustrative example for a $\gamma$-correction approach is given in \href{xcolor2.pdf}{\File{xcolor2.tex}};
3292 % \item |\substitutecolormodel| command for replacement of missing or faulty driver-specific color models;
3293 % \item improved detection and handling of driver-specific color models;
3294 % \item \Option{dvipdfmx} and \Option{xetex} options to support these drivers;
3295 % \item generic driver test file \File{xcolor4.tex}.
3296 % \end{itemize}
3297 % \item Changes:
3298 % \begin{itemize}
3299 % \item |\XC@strip@comma| doesn't generate a trailing space anymore, which improves also the output of the |testcolors| environment.
3300 % \end{itemize}
3301 % \end{itemize}
3302 %
3303 % \subsubsection*{2005/09/30 v2.05}
3304 % \begin{itemize}
3305 % \item New features:
3306 % \begin{itemize}
3307 % \item |testcolors| environment helps to test colors in different models, showing both the visual result and the model-specific parameters;
3308 % \item |\extractcolorspecs| puts model/color specification into two separate commands, as opposed to |\extractcolorspec|;
3309 % \item color names \Color{pink} and \Color{olive} added to the set of predefined colors.
3310 % \end{itemize}
3311 % \item Bugfixes:
3312 % \begin{itemize}
3313 % \item |\definecolor{foo}{named}{bar}| did not work in v2.04.
3314 % \end{itemize}
3315 % \end{itemize}
3316 %
3317 % \subsubsection*{2005/09/23 v2.04}
3318 % \begin{itemize}
3319 % \item New features:
3320 % \begin{itemize}
3321 % \item preparation for usage of additional -- driver-provided -- color models;
3322 % \item \Package{pstricks} users may now specify explicit color parameters within |\psset| and related commands, e.g., |\psset{linecolor=[rgb]{1,0,0}}|; an illustrative example is given in \href{xcolor2.pdf}{\File{xcolor2.tex}}.
3323 % \end{itemize}
3324 % \item Changes:
3325 % \begin{itemize}
3326 % \item color model names sanitized (i.e., turned to catcode~12) throughout the package;
3327 % \item |\@namelet| command deprecated because of name clash with \Package{memoir} --- please use |\XC@let@cc| instead (more |\XC@let@..| commands are available as well);
3328 % \item simplified color conversion code by using the new |\XC@ifxcase| command;
3329 % \item some minor changes to internal macros.
3330 % \end{itemize}
3331 % \end{itemize}
3332 %
3333 % \subsubsection*{2005/06/06 v2.03}
3334 % \begin{itemize}
3335 % \item New features:
3336 % \begin{itemize}
3337 % \item \Option{fixpdftex} option loads \Package{pdfcolmk} package in order to improve pdf\TeX's color behaviour during page breaks.
3338 % \end{itemize}
3339 % \item Changes:
3340 % \begin{itemize}
3341 % \item some minor changes to internal macros.
3342 % \end{itemize}
3343 % \item Bugfixes:
3344 % \begin{itemize}
3345 % \item due to an incorrect |\if| statement within |\XC@info|, |\colorlet| caused trouble whenever its second argument started with two identical letters, e.g., |\colorlet{rab}{oof}|;
3346 % \item argument processing of |\XC@getcolor| caused incompatibility with \Package{msc} package;
3347 % \item \Option{prologue} option caused incompatibility with \Package{preview} package.
3348 % \end{itemize}
3349 % \end{itemize}
3350 %
3351 % \subsubsection*{2005/03/24 v2.02}
3352 % \begin{itemize}
3353 % \item New features:
3354 % \begin{itemize}
3355 % \item |\aftergroupedef| command to reproduce |\aftergroupdef|'s behaviour prior to v2.01;
3356 % \item \XC's homepage \XCW{} now provides also a ready-to-run TDS-compliant archive containing all required files.
3357 % \end{itemize}
3358 % \item Changes:
3359 % \begin{itemize}
3360 % \item |\rowcolors| and friends are solely enabled by the \Option{table} option;
3361 % \item |\@ifxempty| changed back to more robust variant of v2.00.
3362 % \end{itemize}
3363 % \item Bugfixes:
3364 % \begin{itemize}
3365 % \item |\psset{linecolor=\ifcase\foo| |red\or green\or blue\fi}| did not work with \Package{pstricks} (error introduced in v2.01).
3366 % \end{itemize}
3367 % \end{itemize}
3368 %
3369 % \subsubsection*{2005/03/15 v2.01}
3370 % \begin{itemize}
3371 % \item New features:
3372 % \begin{itemize}
3373 % \item \Option{prologue} option for comprehensive `named' color support in conjunction with \Option{dvips}: on-the-fly generation of \Index{PostScript} prologue files with all color definitions, ready for \Program{dvips} inclusion and/or post-processing with device-specific parameters (e.g., spot colors);
3374 % \item \Program{dvips} prologue file \File{xcolor.pro} to support additional `named' colors;
3375 % \item |\colorlet| may now also be used to create named colors from arbitrary color expressions;
3376 % \item enhanced color definition syntax to allow for target-model specific color parameters, e.g., |\definecolor| |{red}{rgb/cmyk}{1,0,0/0,1,1,0}|, facilitating the usage of tailor-made colors both for displays and printers;
3377 % \item `deferred definition' of colors: |\preparecolor| and |\definecolors| enable decoupling of color specification and control sequence generation, especially useful (= memory saving) for large lists of colors, of which only a few names are actually used;
3378 % \item \Option{dvipsnames*} and \Option{svgnames*} options to support deferred definition.
3379 % \end{itemize}
3380 % \item Changes:
3381 % \begin{itemize}
3382 % \item higher accuracy: most complement calculations are now exact for all 5-digit decimals;
3383 % \item |\rangeRGB| and similar variables may now be changed at any point in a document;
3384 % \item |\aftergroupdef| now performs only a first-level expansion of its code argument;
3385 % \item |\XCfileversion| and similar internal constants removed from \File{.sty} and \File{.def} files;
3386 % \item improved memory management (reduced generation of `multiletter control sequences' by |\@ifundefined| tests);
3387 % \item several internal macros improved and/or renamed.
3388 % \end{itemize}
3389 % \item Bugfixes:
3390 % \begin{itemize}
3391 % \item |\XC@getcolor| could cause unwanted spaces when |\psset| was used inside |pspicture| environments (\Package{pstricks});
3392 % \item arithmetic overflow could happen when too many decimal digits were used within color parameters, e.g., as a result of \Package{fp} calculations.
3393 % \end{itemize}
3394 % \end{itemize}
3395 %
3396 % \subsubsection*{2004/07/04 v2.00}
3397 % \begin{itemize}
3398 % \item New features:
3399 % \begin{itemize}
3400 % \item extended functionality for color expressions: mix colors like a painter;
3401 % \item support for color blending: specify color mix expressions that are being blended with every displayed color;
3402 % \item |\xglobal| command for selective control of globality for color definitions, blends, and masks;
3403 % \item multiple step operations (e.g., |\color{foo!!+++}|) and access to individual members (e.g., |\color{foo!![7]}|) in color series;
3404 % \item |\providecolor| command to define only non-existent colors;
3405 % \item |\definecolorset| and |\providecolorset| commands to facilitate the construction of color sets with common underlying color model;
3406 % \item additional 147 predefined color names according to \Index{SVG}~1.1 specification;
3407 % \item \Key{xpdfborder} key for setting the width of hyperlink borders in a more driver-independent way if \Program{dvips} is used.
3408 % \end{itemize}
3409 % \item Changes:
3410 % \begin{itemize}
3411 % \item \LCP{} now completely integrated within \XC;
3412 % \item \oOption{override}, \oOption{usenames}, \oOption{nodvipsnames} options and |\xdefinecolor| command no longer needed;
3413 % \item \Option{dvips} and \Option{dvipsnames} options now independent of each other;
3414 % \item |\tracingcolors|'s behaviour changed to make it more versatile and reduce log file size in standard cases;
3415 % \item |\rdivide|'s syntax made more flexible (divide by numbers and/or dimensions);
3416 % \item code restructured, some internal commands renamed;
3417 % \item documentation rearranged and enhanced.
3418 % \end{itemize}
3419 % \item Bugfixes:
3420 % \begin{itemize}
3421 % \item |\definecolor{foo}{named}{bar}| did not work (error introduced in v1.11);
3422 % \item more robust behaviour of conditionals within \Package{pstricks} key-values.
3423 % \end{itemize}
3424 % \end{itemize}
3425 %
3426 % \subsubsection*{2004/05/09 v1.11}
3427 % \begin{itemize}
3428 % \item New features:
3429 % \begin{itemize}
3430 % \item switch |\ifglobalcolors| to control whether color definitions are global or local;
3431 % \item option \Option{hyperref} provides color expression support for the border colors of hyperlinks, e.g., |\hypersetup| |{xurlbordercolor=red!50!yellow}|;
3432 % \item internal hooks |\XC@bcolor|, |\XC@mcolor|, and |\XC@ecolor| for additional code that has to be executed immediately before/after the current color is being displayed.
3433 % \end{itemize}
3434 % \item Changes:
3435 % \begin{itemize}
3436 % \item |\XC@logcolor| renamed to |\XC@display|, which is now the core color display command;
3437 % \item improved interface to \Package{pstricks}.
3438 % \end{itemize}
3439 % \end{itemize}
3440 %
3441 % \subsubsection*{2004/03/27 v1.10}
3442 % \begin{itemize}
3443 % \item New features:
3444 % \begin{itemize}
3445 % \item support for \nModel{named} model;
3446 % \item support for \Program{dvips} colors (may now be used within color expressions);
3447 % \item internal representation of `ordinary' and `named' colors merged into unified data structure;
3448 % \item allow multiple `-' signs at the beginning of color expressions.
3449 % \end{itemize}
3450 % \item Bugfixes:
3451 % \begin{itemize}
3452 % \item commands like |\color[named]{foo}| caused errors when color masking or target model conversion were active;
3453 % \item incompatibility with \Package{soul} package: commands |\hl|, |\ul|, etc. could yield unexpected results.
3454 % \end{itemize}
3455 % \item Documentation:
3456 % \begin{itemize}
3457 % \item added formula for general color expressions;
3458 % \item enhanced text and index;
3459 % \item removed dependence of index generation on local configuration file.
3460 % \end{itemize}
3461 % \end{itemize}
3462 %
3463 % \subsubsection*{2004/02/16 v1.09}
3464 % \begin{itemize}
3465 % \item New features:
3466 % \begin{itemize}
3467 % \item color model \Model{HTML}, a 24-bit hexadecimal \Model{RGB} variant; allows to specify colors like |\color[HTML]{AFFE90}|;
3468 % \item color names \Color{orange}, \Color{violet}, \Color{purple}, and \Color{brown} added to the set of predefined colors.
3469 % \end{itemize}
3470 % \item New \XC{} homepage: \XCW
3471 % \item Bugfix: |\xdefinecolor| sometimes did not normalise its parameters.
3472 % \item Changes:
3473 % \begin{itemize}
3474 % \item slight improvements of the documentation;
3475 % \item example file |xcolor1.tex| reorganised and abridged.
3476 % \end{itemize}
3477 % \end{itemize}
3478 %
3479 % \subsubsection*{2004/02/04 v1.08}
3480 % \begin{itemize}
3481 % \item New commands:
3482 % \begin{itemize}
3483 % \item |\selectcolormodel| to change the target model within a document;
3484 % \item |\adjustUCRBG| to fine-tune undercolor-removal and black-generation during conversion to \Model{cmyk}.
3485 % \end{itemize}
3486 % \item Bugfix: color expressions did not work correctly in connection with active `!' character, e.g., in case of |\usepackage[frenchb]babel}|.
3487 % \item Code re-organisation:
3488 % \begin{itemize}
3489 % \item |\XC@xdefinecolor| merged into |\xdefinecolor|, making the first command obsolete;
3490 % \item several internal commands improved/streamlined.
3491 % \end{itemize}
3492 % \end{itemize}
3493 %
3494 % \subsubsection*{2004/01/20 v1.07}
3495 % \begin{itemize}
3496 % \item New feature: support for color masking and color separation.
3497 % \item New commands:
3498 % \begin{itemize}
3499 % \item |\rmultiply| to multiply a dimension register by a real number;
3500 % \item |\xcolorcmd| to pass commands that are to be executed at the end of the package.
3501 % \end{itemize}
3502 % \item Changes:
3503 % \begin{itemize}
3504 % \item more consistent color handling: extended colors now always take precedence over standard colors;
3505 % \item several commands improved by using code from the \LaTeX{} kernel.
3506 % \end{itemize}
3507 % \item Documentation: some minor changes.
3508 % \item Example files: additional \Package{pstricks} examples (file \href{xcolor2.pdf}{\File{xcolor2.tex}}).
3509 % \end{itemize}
3510 %
3511 % \subsubsection*{2003/12/15 v1.06}
3512 % \begin{itemize}
3513 % \item New feature: extended color expressions, allowing for cascaded mix operations, e.g., |\color{red!30!green!40!blue}|.
3514 % \item Documentation: new section on color expressions.
3515 % \item Bugfix:~color series stepping did not work correctly within non-displaying commands like |\extractcolorspec{foo!!+}| (this bug was introduced in v1.05).
3516 % \item Renamed~commands:~|\ukfileversion| and similar internal constants renamed to |\XCfileversion| etc.
3517 % \item Removed~commands:~|\ifXCpst| and |\ifXCtable| made obsolete by a simple trick.
3518 % \end{itemize}
3519 %
3520 % \subsubsection*{2003/11/21 v1.05}
3521 % \begin{itemize}
3522 % \item Bugfixes:
3523 % \begin{itemize}
3524 % \item package option \Option{hideerrors} should now work as expected;
3525 % \item usage of `.' in the first color expression in a document caused an error due to incorrect initialisation.
3526 % \end{itemize}
3527 % \item Code re-organisation: |\extractcolorspec| now uses |\XC@splitcolor|, making |\XC@extract| obsolete.
3528 % \end{itemize}
3529 %
3530 % \subsubsection*{2003/11/09 v1.04}
3531 % \begin{itemize}
3532 % \item New feature: easy access to current color within color expressions.
3533 % \item New option: \oOption{override} to replace |\definecolor| by |\xdefinecolor|.
3534 % \item New command: |\tracingcolors| for logging color-specific information.
3535 % \end{itemize}
3536 %
3537 % \subsubsection*{2003/09/21 v1.03}
3538 % \begin{itemize}
3539 % \item Change: bypass strange behaviour of some drivers.
3540 % \item New feature: driver-sharing with \Package{hyperref}.
3541 % \end{itemize}
3542 %
3543 % \subsubsection*{2003/09/19 v1.02}
3544 % \begin{itemize}
3545 % \item Change: |\extractcolorspec| and |\colorlet| now also accept color series as arguments.
3546 % \end{itemize}
3547 %
3548 % \subsubsection*{2003/09/15 v1.01}
3549 % \begin{itemize}
3550 % \item New feature: |\definecolorseries| and friends.
3551 % \item Documentation: removed some \Package{doc}-related side-effects.
3552 % \item Code re-organisation: all calculation-related tools put to one place.
3553 % \item Bugfixes:
3554 % \begin{itemize}
3555 % \item |\@rdivide|: added |\relax| to fix problem with negative numerators;
3556 % \item |\rowc@l@rs|: replaced |\@ifempty| by |\@ifxempty|.
3557 % \end{itemize}
3558 % \end{itemize}
3559 %
3560 % \subsubsection*{2003/09/09 v1.00}
3561 % \begin{itemize}
3562 % \item First published release.
3563 % \end{itemize}
3564 %
3565 % \end{multicols}
3566 % \end{adjustwidth}
3567 %
3568 % \StopEventually{}
3569 % \clearpage
3570 %
3571 % \section{The Implementation}
3572 %
3573 % Some commands have been copied unchanged from \cite{color} (Copyright (C) 1994--1999 \People{David P.}{Carlisle}), which is part of the Standard \LaTeX{} `Graphics Bundle'.
3574 % Additionally, also some parts of the code documentation were copied from \cite{color}.
3575 %
3576 %
3577 %
3578 % \subsection{Preparation}
3579 % \begin{macrocode}
3580 %<*package>
3581 % \end{macrocode}
3582 %
3583 % \subsubsection{Release handling}
3584 %
3585 % \begin{macrocode}
3586 \providecommand\DeclareRelease[3]{}
3587 \providecommand\DeclareCurrentRelease[2]{}
3588 \DeclareRelease{v2}{0000-00-00}{xcolor-2022-06-12.sty}
3589 \DeclareCurrentRelease{}{2023-11-11}
3590 % \end{macrocode}
3591 %
3592 % \subsubsection{File identification}
3593 %
3594 % \renewcommand*\MacroFont{\footnotesize\ttfamily}
3595 % \renewcommand*\AltMacroFont{\footnotesize\ttfamily\slshape}
3596 %
3597 %
3598 % \fbox{\MacroFont\string\ProvidesPackage\string{xcolor\string}[\XCfiledate\space\XCfileversion\space LaTeX color extensions (UK)]}
3599 %
3600 % \begin{macrocode}
3601 \NeedsTeXFormat{LaTeX2e}
3602 \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
3603 \IfFormatAtLeastTF{2022/06/01}{}
3604 {\RequirePackageWithOptions{xcolor-2022-06-12}}
3605 \IfFormatAtLeastTF{2022/06/01}{}{\endinput}
3606 % \end{macrocode}
3607 %
3608 %
3609 % \subsubsection{Safety first}
3610 %
3611 % \begin{macro}{\XC@catcodes}
3612 % Save catcodes for later restore:
3613 % \begin{macrocode}
3614 \expandafter\edef\csname XC@catcodes\endcsname
3615 {\catcode33 \the\catcode33 % !
3616 \catcode34 \the\catcode34 % "
3617 \catcode39 \the\catcode39 % '
3618 \catcode42 \the\catcode42 % *
3619 \catcode44 \the\catcode44 % ,
3620 \catcode45 \the\catcode45 % -
3621 \catcode46 \the\catcode46 % .
3622 \catcode47 \the\catcode47 % /
3623 \catcode58 \the\catcode58 % :
3624 \catcode59 \the\catcode59 % ;
3625 \catcode60 \the\catcode60 % <
3626 \catcode61 \the\catcode61 % =
3627 \catcode62 \the\catcode62 % >
3628 \catcode63 \the\catcode63 % ?
3629 \catcode64 \the\catcode64 % @
3630 \catcode94 \the\catcode94 % ^
3631 \catcode96 \the\catcode96 % `
3632 \catcode`\noexpand\^^A\the\catcode`\^^A\relax}
3633 % \end{macrocode}
3634 % \end{macro}
3635 %
3636 % \begin{macrocode}
3637 \catcode64 11 %
3638 \@makeother\! \@makeother\" \@makeother\' \@makeother\* \@makeother\,
3639 \@makeother\- \@makeother\. \@makeother\/ \@makeother\: \@makeother\;
3640 \@makeother\< \@makeother\= \@makeother\> \@makeother\? \@makeother\`
3641 \catcode94 7 %
3642 \catcode`\^^A=14 %
3643 % \end{macrocode}
3644 %
3645 %
3646 % \subsubsection{Constants}
3647 %
3648 % \begin{macro}{\XC@@}
3649 % Macro consisting of the macro |\\XC@@|, serves as a delimiter.
3650 % \begin{macrocode}
3651 \edef\XC@@{\expandafter\noexpand\csname\@backslashchar XC@@\endcsname}
3652 % \end{macrocode}
3653 % \end{macro}
3654 %
3655 %
3656 % \subsubsection{Switches}
3657 %
3658 % \begin{macro}{\ifcolors@}
3659 % This boolean can be tested by higher level macros that may want to alter their behaviour if a monochrome driver is being used.
3660 % \begin{macrocode}
3661 \newif\ifcolors@ \colors@true
3662 % \end{macrocode}
3663 % \end{macro}
3664 %
3665 % \begin{macro}{\ifcolorerrors@}
3666 % Controls whether missing color models/names result in error or warning messages.
3667 % \begin{macrocode}
3668 \newif\ifcolorerrors@
3669 % \end{macrocode}
3670 % \end{macro}
3671 %
3672 % \begin{macro}{\ifglobalcolors}
3673 % Controls whether |\definecolor| and |\colorlet| generate global or local color definitions.
3674 % \begin{macrocode}
3675 \newif\ifglobalcolors \globalcolorsfalse
3676 % \end{macrocode}
3677 % \end{macro}
3678 %
3679 % \begin{macro}{\ifdefinecolors}
3680 % Controls whether |\definecolorset| should \emph{define} or \emph{prepare} colors.
3681 % \begin{macrocode}
3682 \newif\ifdefinecolors \definecolorstrue
3683 % \end{macrocode}
3684 % \end{macro}
3685 %
3686 % \begin{macro}{\ifconvertcolorsD}
3687 % \begin{macro}{\ifconvertcolorsU}
3688 % Control whether conversion to target models take place at \emph{definition} time (|\ifconvertcolorsD|) and/or \emph{usage} (|\ifconvertcolorsU|).
3689 % \begin{macrocode}
3690 \newif\ifconvertcolorsD
3691 \newif\ifconvertcolorsU
3692 % \end{macrocode}
3693 % \end{macro}
3694 % \end{macro}
3695 %
3696 % \begin{macro}{\ifblendcolors}
3697 % \begin{macro}{\ifmaskcolors}
3698 % Control whether colors are to be blended and/or masked at display time.
3699 % \begin{macrocode}
3700 \newif\ifblendcolors
3701 \newif\ifmaskcolors
3702 % \end{macrocode}
3703 % \end{macro}
3704 % \end{macro}
3705 %
3706 % \begin{macro}{\ifXC@@fbox}
3707 % \begin{macro}{\ifXC@@tst}
3708 % Auxiliary test variables.
3709 % \begin{macrocode}
3710 \newif\ifXC@@fbox \XC@@fboxtrue
3711 \newif\ifXC@@tst
3712 % \end{macrocode}
3713 % \end{macro}
3714 % \end{macro}
3715 %
3716 %
3717 % \subsubsection{Error handling}
3718 %
3719 % \begin{macro}{\c@lor@error}
3720 % Multi-purpose error handler (issues warnings instead of errors if the \Option{hideerrors} option is used).
3721 % This command is used already in the options section.
3722 % \begin{macrocode}
3723 \def\c@lor@error#1%
3724 {\ifcolorerrors@\PackageError{xcolor}{Undefined color #1}\@ehc
3725 \else\PackageWarning{xcolor}{Undefined color #1}\fi}
3726 % \end{macrocode}
3727 % \end{macro}
3728 %
3729 %
3730 % \subsubsection{Macro concatenation}
3731 %
3732 % \begin{macro}{\XC@append}
3733 % \marg{cmd}\marg{token list}\\
3734 % Append \Meta{token list} to the definition of \Meta{cmd}.
3735 % This command is used already in the options section.
3736 % \begin{macrocode}
3737 \def\XC@append#1#2%
3738 {\ifx#1\@undefined\def#1{#2}\else\ifx#1\relax\def#1{#2}\else
3739 \toks@\expandafter{#1#2}\edef#1{\the\toks@}\fi\fi}
3740 % \end{macrocode}
3741 % \end{macro}
3742 %
3743 %
3744 % \subsubsection{Macro definition}
3745 %
3746 % The following |\XC@let@..| commands mimic \LaTeX3's coding syntax for the type of arguments used:
3747 % the `c' type is for brace delimited arguments which turn into a control sequence inside |\csname ... \endcsname|, whereas `N' is just a single token.
3748 % Thanks to \People{Morten}{H\o gholm} for pointing me to that.
3749 %
3750 % \begin{macro}{\XC@let@cc}
3751 % \marg{target character string}\marg{source character string}\\
3752 % Performs |\let\|\Meta{target character string}|=\|\Meta{source character string}.
3753 % \begin{macrocode}
3754 \def\XC@let@cc#1{\expandafter\XC@let@Nc\csname#1\endcsname}
3755 % \end{macrocode}
3756 % \end{macro}
3757 %
3758 % \begin{macro}{\@namelet}
3759 % This is provided for compatibility reasons only, although deprecated because of a name clash with \Package{memoir}.
3760 % \begin{macrocode}
3761 \providecommand*\@namelet[1]{\expandafter\XC@let@Nc\csname#1\endcsname}
3762 % \end{macrocode}
3763 % \end{macro}
3764 %
3765 % \begin{macro}{\XC@let@Nc}
3766 % \marg{target name}\marg{source character string}\\
3767 % Performs |\let|\Meta{target name}|=\|\Meta{source character string}.
3768 % Formerly called |\@@namelet|.
3769 % \begin{macrocode}
3770 \def\XC@let@Nc#1#2{\expandafter\let\expandafter#1\csname#2\endcsname}
3771 % \end{macrocode}
3772 % \end{macro}
3773 %
3774 % \begin{macro}{\XC@let@cN}
3775 % \marg{target character string}\marg{source name}\\
3776 % Performs |\let\|\Meta{target character string}|=|\Meta{source name}.
3777 % \begin{macrocode}
3778 \def\XC@let@cN#1{\expandafter\let\csname#1\endcsname}
3779 % \end{macrocode}
3780 % \end{macro}
3781 %
3782 % \begin{macro}{\@namexdef}
3783 % \marg{character string}\marg{code}\\
3784 % Performs |\xdef\|\Meta{character string}|{|\Meta{code}|}|.
3785 % Similar to the \LaTeX{} internal |\@namedef| command.
3786 % \begin{macrocode}
3787 \def\@namexdef#1{\expandafter\xdef\csname #1\endcsname}
3788 % \end{macrocode}
3789 % \end{macro}
3790 %
3791 % \begin{macro}{\aftergroupdef}
3792 % \begin{macro}{\aftergroupedef}
3793 % \marg{cmd}\marg{code}\\
3794 % Defines \meta{cmd} with the first-level or complete expansion of \meta{code} after the end of the current group.
3795 % \begin{macrocode}
3796 \def\aftergroupdef#1#2%
3797 {\expandafter\endgroup\expandafter\def\expandafter#1\expandafter{#2}}
3798 \def\aftergroupedef#1#2%
3799 {\edef\@@tmp{\def\noexpand#1{#2}}\expandafter\endgroup\@@tmp}
3800 % \end{macrocode}
3801 % \end{macro}
3802 % \end{macro}
3803 %
3804 % \begin{macro}{\XC@edef}
3805 % \begin{macro}{\XC@mdef}
3806 % \begin{macro}{\XC@sdef}
3807 % \marg{cmd}\marg{code}\\
3808 % Defines \Meta{cmd} as a safe expansion of \Meta{code}; needed for color expressions in certain languages.
3809 % The second form is a streamlined version that takes only care of active `|/|' and `|:|' characters that may occur in \Meta{model-list} and \Meta{spec-list} arguments.
3810 % The third form defines a sanitized expansion without considering active characters.
3811 % It is faster since it needs no grouping operation.
3812 % \begin{macrocode}
3813 \begingroup
3814 \catcode`\!=13 \catcode`\:=13 \catcode`\-=13 \catcode`\+=13
3815 \catcode`\;=13 \catcode`\/=13 \catcode`\"=13 \catcode`\>=13
3816 \gdef\XC@edef#1#2%
3817 {\begingroup
3818 \ifnum\catcode`\!=13 \edef!{\string!}\fi
3819 \ifnum\catcode`\:=13 \edef:{\string:}\fi
3820 \ifnum\catcode`\-=13 \edef-{\string-}\fi
3821 \ifnum\catcode`\+=13 \edef+{\string+}\fi
3822 \ifnum\catcode`\;=13 \edef;{\string;}\fi
3823 \ifnum\catcode`\"=13 \edef"{\string"}\fi
3824 \ifnum\catcode`\>=13 \edef>{\string>}\fi
3825 \edef#1{#2}\@onelevel@sanitize#1\aftergroupdef#1#1}
3826 \gdef\XC@mdef#1#2%
3827 {\begingroup
3828 \ifnum\catcode`\/=13 \edef/{\string/}\fi
3829 \ifnum\catcode`\:=13 \edef:{\string:}\fi
3830 \edef#1{#2}\@onelevel@sanitize#1\aftergroupdef#1#1}
3831 \endgroup
3832 \def\XC@sdef#1#2{\edef#1{#2}\@onelevel@sanitize#1}
3833 % \end{macrocode}
3834 % \end{macro}
3835 % \end{macro}
3836 % \end{macro}
3837 %
3838 %
3839 % \subsubsection{Conditional processing}
3840 %
3841 % \begin{macro}{\@ifxempty}
3842 % \marg{arg}\marg{empty}\marg{non-empty}\\
3843 % Tests without expanding, whether the argument \Meta{arg} is empty and executes the following code accordingly; \Meta{arg} must not start with the token |\XC@@|.
3844 % Can also be used within |\edef|.
3845 % \begin{macrocode}
3846 \def\@ifxempty#1{\@@ifxempty#1\@@ifxempty\XC@@}
3847 \def\@@ifxempty#1#2\XC@@
3848 {\ifx#1\@@ifxempty
3849 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
3850 % \end{macrocode}
3851 % \end{macro}
3852 %
3853 % \begin{macro}{\XC@ifxcase}
3854 % \marg{cmd}|{{|\Meta[1]{cmd}|}{|\Meta[1]{code}|}...{|\Meta[n]{cmd}|}{|\Meta[n]{code}|}}|\marg{default code}\\
3855 % Performs the test |\ifx|\Meta{cmd}\Meta[k]{cmd} for $k=1,\dots,n$.
3856 % If for some $k$ the test is `true', then the attached code \Meta[k]{code} is executed.
3857 % If all tests are `false', then \Meta{default code} is executed.
3858 % \begin{macrocode}
3859 \long\def\XC@ifxcase#1#2#3%
3860 {\long\def\XC@if@##1##2%
3861 {\ifx#1##1%
3862 \toks@{##2}\expandafter\remove@to@nnil\else\expandafter\XC@if@\fi}%
3863 \XC@if@#2#1{#3}\@nnil\the\toks@}
3864 % \end{macrocode}
3865 % \end{macro}
3866 %
3867 % \begin{macro}{\XC@ifcase}
3868 % \marg{str}|{{|\Meta[1]{str-list}|}{|\Meta[1]{code}|}...{|\Meta[n]{str-list}|}{|\Meta[n]{code}|}}|\marg{default code}\\
3869 % Tests whether \Meta{str} appears in one of the comma-separated lists \Meta[k]{str-list}.
3870 % Performs the test |\if|\Meta{str}\Meta[kl]{str} for $k=1,\dots,n$ and $l=1,\ldots,m_n$.
3871 % If for some $k,l$ the test is `true', then the attached code \Meta[k]{code} is executed.
3872 % If all tests are `false', then \Meta{default code} is executed.
3873 % \changes{3.0}{2022-08-10}{moved the patch from hycolor to correct Gray model, issue \#23}
3874 % \begin{macrocode}
3875 \long\def\XC@ifcase#1#2#3%
3876 {\long\def\XC@if@##1##2%
3877 {\@expandtwoargs\in@{,#1,}{,##1,}\ifin@
3878 \toks@{##2}\expandafter\remove@to@nnil\else\expandafter\XC@if@\fi}%
3879 \XC@if@#2{#1}{#3}\@nnil\the\toks@}
3880 % \end{macrocode}
3881 % \end{macro}
3882 %
3883 %
3884 %
3885 % \subsubsection{Color model selection}
3886 %
3887 % \begin{macro}{\selectcolormodel}
3888 % \marg{num model}\\
3889 % Determines the target model for color definitions with |\definecolor| and friends.
3890 % \begin{macrocode}
3891 \def\selectcolormodel#1%
3892 {\@ifundefined{XC@mod@#1}%
3893 {\c@lor@error{target model `#1'}}%
3894 {\expandafter\ifx\csname XC@mod@#1\endcsname\XC@mod@natural
3895 \def\XC@tgt@mod##1{##1}\convertcolorsDfalse\convertcolorsUfalse
3896 \else\expandafter\ifx\csname XC@mod@#1\endcsname\XC@mod@named
3897 \c@lor@error{target model `#1'}
3898 \else
3899 \edef\XC@tgt@mod##1{#1}\convertcolorsDtrue\convertcolorsUtrue
3900 \fi\fi}}
3901 % \end{macrocode}
3902 % \end{macro}
3903 %
3904 % \begin{macro}{\XC@mod@Hsb}
3905 % \begin{macro}{\XC@mod@tHsb}
3906 % \begin{macro}{\XC@mod@ignore}
3907 % \begin{macro}{\XC@mod@named}
3908 % \begin{macro}{\XC@mod@ps}
3909 % \begin{macro}{\XC@mod@wave}
3910 % \begin{macro}{\XC@mod@natural}
3911 % \begin{macro}{\XC@mod@rgb}
3912 % \begin{macro}{\XC@mod@cmy}
3913 % \begin{macro}{\XC@mod@cmyk}
3914 % \begin{macro}{\XC@mod@hsb}
3915 % \begin{macro}{\XC@mod@gray}
3916 % \begin{macro}{\XC@mod@RGB}
3917 % \begin{macro}{\XC@mod@HTML}
3918 % \begin{macro}{\XC@mod@HSB}
3919 % \begin{macro}{\XC@mod@Gray}
3920 % Put model names into commands and define package options
3921 % \Option{natural}, \Option{rgb}, \Option{cmy}, \Option{cmyk}, \Option{hsb}, \Option{gray}, \Option{RGB}, \Option{HTML}, \Option{HSB}, \Option{Gray}.
3922 % \begin{macrocode}
3923 \@tfor\@@tmp:={Hsb}{tHsb}{ignore}{named}{ps}{wave}\do
3924 {\expandafter\XC@sdef\csname XC@mod@\@@tmp\endcsname{\@@tmp}}
3925 % \end{macrocode}
3926 %
3927 % \begin{macrocode}
3928 \@tfor\@@tmp:={natural}{rgb}{cmy}{cmyk}{hsb}{gray}{RGB}{HTML}{HSB}{Gray}\do
3929 {\expandafter\XC@sdef\csname XC@mod@\@@tmp\endcsname{\@@tmp}%
3930 \edef\@@tmp
3931 {\noexpand\DeclareKeys{\@@tmp .code= {\noexpand\selectcolormodel{\@@tmp}}}}%
3932 \@@tmp}
3933 % \end{macrocode}
3934 % \end{macro}
3935 % \end{macro}
3936 % \end{macro}
3937 % \end{macro}
3938 % \end{macro}
3939 % \end{macro}
3940 % \end{macro}
3941 % \end{macro}
3942 % \end{macro}
3943 % \end{macro}
3944 % \end{macro}
3945 % \end{macro}
3946 % \end{macro}
3947 % \end{macro}
3948 % \end{macro}
3949 % \end{macro}
3950 %
3951 % The \Option{monochrome} option should be used \emph{in addition} to one of the standard driver options.
3952 % \begin{macrocode}
3953 \DeclareKeys
3954 {
3955 monochrome .code =
3956 {
3957 \colorerrors@false
3958 \AtEndOfPackage
3959 {\colors@false
3960 \def\set@color{\c@lor@special\m@ne
3961 {color push \current@color}\aftergroup\reset@color}%
3962 \def\reset@color{\c@lor@special\m@ne{color pop}}%
3963 \def\set@page@color{\c@lor@special\m@ne{background \current@color}}}
3964 }
3965 ,monochrome .usage = load
3966 }
3967 % \end{macrocode}
3968 %
3969 %
3970 % \subsubsection{Sets of predefined colors}
3971 %
3972 % \begin{macro}{\XC@@names}
3973 % Initialise the macro to hold the names of files that contain predefined colors; these files are loaded near to the end of this package.
3974 % \begin{macrocode}
3975 \let\XC@@names\relax
3976 % \end{macrocode}
3977 % \end{macro}
3978 %
3979 % \begin{macro}{\colornameprefix}
3980 % \begin{macro}{\XC@@nameprefix}
3981 % Initialise the macro to hold the string that is prefixed to driver-specific color names.
3982 % Save the value for later restore.
3983 % \begin{macrocode}
3984 \providecommand*\colornameprefix{XC@}
3985 \let\XC@@nameprefix\colornameprefix
3986 % \end{macrocode}
3987 % \end{macro}
3988 % \end{macro}
3989 %
3990 % \begin{macro}{\XC@declarenames}
3991 % \marg{base name}\marg{file name}\marg{initial commands}\\
3992 % Construct package options for color names.
3993 % \begin{macrocode}
3994 \def\XC@declarenames#1#2#3%
3995 {%
3996 \DeclareKeys
3997 {
3998 #1 .code =
3999 {
4000 \AddToHook{package/xcolor/after}
4001 {#3\definecolorstrue\input{#2.def}\definecolorstrue
4002 \let\colornameprefix\XC@@nameprefix}%
4003 \DeclareKeys[xcolor]{#1 .code = {},#1* .code={}}
4004 }
4005 ,#1 .usage = preamble
4006 ,#1* .code =
4007 {
4008 \AddToHook{package/xcolor/after}
4009 {#3\definecolorsfalse\input{#2.def}\definecolorstrue
4010 \let\colornameprefix\XC@@nameprefix}
4011 \DeclareKeys[xcolor]{#1 .code = {},#1* .code={}}
4012 }
4013 ,#1* .usage = preamble
4014 }%
4015 }
4016 % \end{macrocode}
4017 % \end{macro}
4018 %
4019 % \begin{macrocode}
4020 \XC@declarenames{dvipsnames}{dvipsnam}{\let\colornameprefix\@empty}
4021 \XC@declarenames{svgnames}{svgnam}{}
4022 \XC@declarenames{x11names}{x11nam}{}
4023 \XC@declarenames{hksnames}%
4024 {hks\ifcase\paperquality k\or n\or k\or z\else n\fi nam}{}
4025 \XC@declarenames{pmsnames}{pmsnam}{}
4026 \XC@declarenames{ralnames}{ralnam}{}
4027 % \end{macrocode}
4028 %
4029 %
4030 % \subsubsection{Support for other packages}
4031 %
4032 % Use this option to load \People{David P.}{Carlisle}'s \Package{colortbl} package:
4033 % \begin{macrocode}
4034 \DeclareKeys
4035 {
4036 table .code ={\AddToHook{package/xcolor/after}{\RequirePackage{colortbl}}}
4037 ,table .usage = preamble
4038 }
4039 % \end{macrocode}
4040 %
4041 % \subsubsection{Driver options}
4042 %
4043 % \begin{macro}{\Gin@driver}
4044 % Initialise the macro to hold the driver file name.
4045 % \begin{macrocode}
4046 \providecommand*\Gin@driver{}
4047 % \end{macrocode}
4048 %
4049 % Drivers that come with their individual definition files:
4050 % \begin{macrocode}
4051 \@tfor\@@tmp:={dvipdf}{dvipdfmx}{dvips}{dvipsone}{dviwin}%
4052 {emtex}{luatex}{pctex32}{pctexhp}{pctexps}{pctexwin}{pdftex}%
4053 {tcidvi}{textures}{truetex}{vtex}{xetex}{dvisvgm}\do
4054 {\edef\@@tmp{%
4055 \noexpand\DeclareKeys
4056 {
4057 \@@tmp .code = {\def\noexpand\Gin@driver{\@@tmp.def}},
4058 \@@tmp .usage=load
4059 }}%
4060 \@@tmp}
4061 % \end{macrocode}
4062 %
4063 % Drivers that are derivatives of others:
4064 % \begin{macrocode}
4065 \DeclareKeys
4066 {
4067 ,dviwindo .code = {\SetKeys{dvipsone}}
4068 ,dviwindo .usage = load
4069 ,oztex .code = {\SetKeys{dvips}}
4070 ,oztex .usage = load
4071 ,xdvi .code = {\SetKeys{dvips,monochrome}}
4072 ,xdvi .usage = load
4073 ,dvipdfm .code = {\SetKeys{dvipdfmx}}
4074 ,dvipdfm .usage = load
4075 }
4076 % \end{macrocode}
4077 %
4078 % Options used by (some) drivers.
4079 % \begin{macrocode}
4080 \DeclareKeys
4081 {
4082 ,xcdraw .code = {\def\XC@@xcd@{1}}
4083 ,xcdraw .usage = load %TODO check
4084 ,noxcdraw .code = {\def\XC@@xcd@{-1}}
4085 ,noxcdraw .usage = load %TODO check
4086 ,fixinclude .code = {\def\XC@@xcf@{1}}
4087 ,fixinclude .usage = load %TODO check
4088 ,prologue .code = {\def\XC@@xcp@{1}}
4089 ,prologue .usage = load %TODO check
4090 % \end{macrocode}
4091 % \end{macro}
4092 %
4093 %
4094 % \subsubsection{Other options}
4095 %
4096 % Switch to original kernel |\fbox| command instead of new \XC{} version.
4097 % \begin{macrocode}
4098 ,kernelfbox .code = {\XC@@fboxfalse}
4099 ,kernelfbox .usage = load %TODO check
4100 % \end{macrocode}
4101 %
4102 % These options control how non-existing colors are treated:
4103 % \begin{macrocode}
4104 ,showerrors .code = {\colorerrors@true}
4105 ,hideerrors .code = {\colorerrors@false}
4106 % \end{macrocode}
4107 %
4108 % The \Option{debugshow} option turns on debugging info (perhaps).
4109 % \begin{macrocode}
4110 ,debugshow .code = {\catcode`\^^A=9 \let\GDebug\typeout}
4111 }
4112 % \end{macrocode}
4113 %
4114 % \subsubsection{Obsolete options}
4115 % The following options are obsolete but perhaps still around in the wild,
4116 % so we generate a warning.
4117 % \begin{macrocode}
4118 \DeclareKeys
4119 {
4120 ,usenames .code =
4121 {\PackageWarning{xcolor}{Package option `usenames' is obsolete and ignored}}
4122 ,usenames .usage = preamble
4123 ,hyperref .code =
4124 {\PackageWarning{xcolor}{Package option `hyperref' is obsolete and ignored}}
4125 ,hyperref .usage = preamble
4126 ,fixpdftex .code =
4127 {\PackageWarning{xcolor}{Package option `fixpdftex' is obsolete and ignored}}
4128 ,fixpdftex .usage = preamble
4129 }
4130 % \end{macrocode}
4131 %
4132 % All other options (including \LC's \oOption{nodvipsnames}) error.
4133 %
4134 % Choose default options:
4135 % \begin{macrocode}
4136 \def\XC@@xcd@{-1}
4137 \def\XC@@xcf@{-1}
4138 \def\XC@@xcp@{-1}
4139 \SetKeys{natural,showerrors}
4140 % \end{macrocode}
4141 %
4142 % \subsubsection{Processing options}
4143 %
4144 % A local configuration file may declare more options.
4145 % It should also make one driver option the default, by calling |\ExecuteOptions| with the appropriate option.
4146 % \begin{macrocode}
4147 \let\XC@ExecuteOptions\ExecuteOptions
4148 \ExplSyntaxOn
4149 \def\ExecuteOptions{\keys_set_known:nn {xcolor}}
4150 \ExplSyntaxOff
4151 \InputIfFileExists{color.cfg}{}{}
4152 \let\ExecuteOptions\XC@ExecuteOptions
4153 % \end{macrocode}
4154 %
4155 % After the options are processed, load the appropriate driver file.
4156 % If a site wants a default driver (e.g., \Option{dvips}) it just needs
4157 % to put |\ExecuteOptions{dvips}| in a \File{color.cfg} file.
4158 %
4159 % Note |\relax| added here to ensure that |\ProcessKeyOptions| not the following
4160 % |\edef| shows in error context lines for unknown options.
4161 % \changes{3.02}{2024-03-13}{Added \cs{relax}}
4162 % \begin{macrocode}
4163 \ProcessKeyOptions\relax
4164 % \end{macrocode}
4165 %
4166 % \begin{macro}{\XC@@drv}
4167 % Holds the name of the loaded driver (without \File{.def} extension).
4168 % \begin{macrocode}
4169 \edef\Gin@driver{\Gin@driver}
4170 \if!\Gin@driver!
4171 \PackageError{xcolor}
4172 {No driver specified}
4173 {You should make a default driver option in a file \MessageBreak
4174 color.cfg\MessageBreak
4175 eg: \protect\ExecuteOptions{dvips}}
4176 \else
4177 \PackageInfo{xcolor}{Driver file: \Gin@driver}
4178 \@ifundefined{ver@\Gin@driver}{\input{\Gin@driver}}{}
4179 \def\@@tmp#1.def{\def\XC@@drv{#1}}
4180 \expandafter\@@tmp\Gin@driver
4181 \fi
4182 % \end{macrocode}
4183 % \end{macro}
4184 %
4185 % \begin{macro}{\XC@@xcd@}
4186 % \begin{macro}{\XC@@xcf@}
4187 % \begin{macro}{\XC@@xcp@}
4188 % These are used firstly by the \Option{xcdraw} and \Option{prologue} options, indicating whether either option is switched on or off.
4189 % Secondly, the macros serve as test variables for |\ifcase| expressions, storing the intended type of output: $-1=\text{dvi}, 0=\text{ps}, 1=\text{pdf}$.
4190 % \begin{macrocode}
4191 \count@\XC@@xcd@ \advance\count@\XC@@xcf@ \advance\count@\XC@@xcp@\relax
4192 \ifnum\count@>-3
4193 % \end{macrocode}
4194 %
4195 % \begin{macro}{\XC@special}
4196 % \meta{code}\\
4197 % Driver-specific variant of |\special|.
4198 % Even if the intended type of output is the same (e.g., pdf), the |\special| commands may differ.
4199 % \begin{macrocode}
4200 \XC@ifcase\XC@@drv
4201 {{dvips,pctex32}%
4202 {\def\@tempa{0}
4203 \def\XC@special#1{\special{ps:XC!b}\special{"#1}\special{ps:XC!e}}}%
4204 {pdftex}%
4205 {\def\@tempa{1}
4206 \def\XC@special#1{\pdfliteral{ q #1 Q }}}%
4207 {luatex}%
4208 {\def\@tempa{1}
4209 \ifnum\luatexversion<87%
4210 \def\XC@special#1{\pdfliteral{ q #1 Q }}%
4211 \else%
4212 \def\XC@special#1{\pdfextension literal{ q #1 Q }}%
4213 \fi}%
4214 {dvipdfm}%
4215 {\def\@tempa{1}
4216 \def\XC@special#1{\special{pdf: content #1}}}%
4217 }{\def\@tempa{-1}}
4218 % \end{macrocode}
4219 % \end{macro}
4220 %
4221 % Since the options are independent of each other, we have to adjust the affiliated test variables independently as well.
4222 % \begin{macrocode}
4223 \ifnum\XC@@xcd@>\m@ne\let\XC@@xcd@\@tempa\fi
4224 \ifnum\XC@@xcf@>\m@ne\let\XC@@xcf@\@tempa\fi
4225 \ifnum\XC@@xcp@>\m@ne\let\XC@@xcp@\@tempa\fi
4226 % \end{macrocode}
4227 %
4228 % \begin{macrocode}
4229 \ifnum\@tempa=0 \AtBeginDvi{\special{header=xcolor.pro}}\fi
4230 \ifcase\XC@@xcf@
4231 \AtBeginDvi{\special{! XCfixnormalscale}}
4232 \fi
4233 \ifcase\XC@@xcp@
4234 \AtBeginDvi{\special{header=\jobname.xcp}}
4235 \newwrite\XC@@xcp\immediate\openout\XC@@xcp=\jobname.xcp
4236 \immediate\write\XC@@xcp{\@percentchar!}
4237 \immediate\write\XC@@xcp{TeXDict begin}
4238 \AtEndDocument
4239 {\immediate\write\XC@@xcp{end}\immediate\closeout\XC@@xcp}
4240 \fi
4241 % \end{macrocode}
4242 %
4243 % End of driver-specific part.
4244 % \begin{macrocode}
4245 \fi
4246 % \end{macrocode}
4247 % \end{macro}
4248 % \end{macro}
4249 % \end{macro}
4250 %
4251 %
4252 % \subsubsection{Required packages}
4253 %
4254 % We pretent that color.sty has already been loaded.
4255 %
4256 % \begin{macrocode}
4257 \@namedef{[email protected]}{1999/02/16}
4258 % \end{macrocode}
4259 %
4260 %
4261 % \subsection{Macro tools}
4262 %
4263 % \subsubsection{General tools}
4264 %
4265 % \begin{macro}{\@secondoffive}
4266 % \begin{macro}{\@thirdoffive}
4267 % Argument grabbing, similar to \LaTeX{} kernel.
4268 % \begin{macrocode}
4269 \long\def\@secondoffive#1#2#3#4#5{#2}
4270 \long\def\@thirdoffive#1#2#3#4#5{#3}
4271 % \end{macrocode}
4272 % \end{macro}
4273 % \end{macro}
4274 %
4275 % \begin{macro}{\xglobal}
4276 % \begin{macro}{\xglobal@test}
4277 % If |\foo| occurs in the token list |\xglobal@@|, then the command |\xglobal\foo| will set the switch |\xglobal@true| which can be used inside |\foo| to determine whether certain definitions are to be made explicitly global.
4278 % |\foo| is responsible for resetting |\xglobal@false| in order to avoid side effects.
4279 % To include |\foo| in the magic list, simply say |\XC@append\xglobal@list{\foo}|.
4280 % If |\foo| is not in the list, |\xglobal\foo| will behave like |\global\foo|, thus |\xglobal\let| will be like |\global\let| etc.
4281 % \begin{macrocode}
4282 \def\xglobal{\xglobal@stop\begingroup\futurelet\@@tok\xglobal@test}
4283 % \end{macrocode}
4284 %
4285 % \begin{macrocode}
4286 \def\xglobal@test
4287 {\expandafter\@tfor\expandafter\@@tmp
4288 \expandafter:\expandafter=\xglobal@list\do
4289 {\expandafter\ifx\@@tmp\@@tok
4290 \aftergroup\let\aftergroup\xglobal@\@break@tfor\fi}%
4291 \endgroup\global}
4292 % \end{macrocode}
4293 % \end{macro}
4294 % \end{macro}
4295 %
4296 % \begin{macro}{\xglobal@stop}
4297 % Resetting |\xglobal@|.
4298 % \begin{macrocode}
4299 \def\xglobal@stop{\let\xglobal@\@empty}
4300 \xglobal@stop
4301 % \end{macrocode}
4302 % \end{macro}
4303 %
4304 % \begin{macro}{\xglobal@list}
4305 % Initial list of commands that may be prefixed by |\xglobal|.
4306 % \begin{macrocode}
4307 \def\xglobal@list
4308 {\definecolor\definecolors\definecolorset\colorlet\providecolor
4309 \providecolors\providecolorset\blendcolors\maskcolors
4310 \substitutecolormodel}
4311 % \end{macrocode}
4312 % \end{macro}
4313 %
4314 % \begin{macro}{\xglobalize@}
4315 % Globalisation command: makes a local definition global.
4316 % \begin{macrocode}
4317 \def\xglobalize@#1{\ifx\xglobal@\global\global\let#1#1\fi}
4318 % \end{macrocode}
4319 % \end{macro}
4320 %
4321 % \begin{macro}{\GetGinDriver}
4322 % Transforms the chosen driver option ready for \Package{hyperref}.
4323 % \begin{macrocode}
4324 \def\GetGinDriver
4325 {\@tempswafalse
4326 \@tfor\@@tmp:={dvips}{luatex}{pdftex}{dvipdf}{dvipdfm}{dvipsone}{vtex}{textures}%
4327 \do{\ifx\XC@@drv\@@tmp\@tempswatrue\@break@tfor\fi}%
4328 \edef\GinDriver{\if@tempswa\XC@@drv\else hypertex\fi}}
4329 % \end{macrocode}
4330 % \end{macro}
4331 %
4332 %
4333 % \subsubsection{String manipulation}
4334 %
4335 % \begin{macro}{\@hex@Hex}
4336 % \Meta{hex-string}|\relax|\\
4337 % Converts \Meta{hex-string} to a string where all letters a--f are changed into their uppercase variants.
4338 % All other letters are left unchanged.
4339 % May be used inside |\edef|.
4340 % \begin{macrocode}
4341 \def\@hex@Hex#1{\ifx#1\relax\else\expandafter\@hex@@Hex\expandafter#1\fi}
4342 \def\@hex@@Hex#1%
4343 {\if a#1A\else \if b#1B\else \if c#1C\else \if d#1D\else
4344 \if e#1E\else \if f#1F\else #1\fi\fi\fi\fi\fi\fi \@hex@Hex}
4345 % \end{macrocode}
4346 % \end{macro}
4347 %
4348 % \begin{macro}{\XC@strip@comma}
4349 % \Meta[1]{string}|,|\Meta[2]{string}|,...,|\Meta[n]{string}|,,\@nnil|\\
4350 % Converts a comma-separated list into a space-separated list.
4351 % The evaluation stops at the first empty argument, skipping all remaining tokens until (and including) |\@nnil|.
4352 % Thus, the list to be converted should always contain at least one `|,,|' sequence.
4353 % May be used inside |\edef|.
4354 % \begin{macrocode}
4355 \def\XC@strip@comma#1,#2%
4356 {\ifx,#2%
4357 #1\expandafter\remove@to@nnil\else#1 \expandafter\XC@strip@comma\fi
4358 #2}
4359 % \end{macrocode}
4360 % \end{macro}
4361 %
4362 % \begin{macro}{\XC@replace}
4363 % \marg{cmd}\marg{search}\marg{replace}\\
4364 % Replace all occurrences of \meta{search} within the first-level expansion of \meta{cmd} by \meta{replace} and save the result in \meta{cmd}.
4365 % The replacement is recursive, so don't put the search pattern into the replacement text!
4366 % Note that this macro is incapable of seeing `into' braces.
4367 % The code and its explanation is taken from \People{Donald}{Arseneau}'s \Package{url} package \cite{url}, with only minor changes and renamings applied.
4368 % The original name of the game is |\Url@Edit|.
4369 % Thanks to \People{Donald}{Arseneau} for giving me valuable hints.
4370 % \begin{macrocode}
4371 {\catcode`Q=3
4372 \gdef\XC@replace#1#2#3%
4373 {\begingroup
4374 % \end{macrocode}
4375 %
4376 % If finished, then remove |\@empty|'s and redefine macro else, re-iterate.
4377 % \begin{macrocode}
4378 \def\XC@repl@ce##1#2##2Q##3%
4379 {\@ifxempty{##2}{\XC@r@pl@ce##1Q}{\XC@repl@ce##1##3##2Q{##3}}}%
4380 \def\XC@r@pl@ce##1\@empty Q%
4381 {\expandafter\endgroup\expandafter\def\expandafter#1\expandafter{##1}}%
4382 % \end{macrocode}
4383 %
4384 % The leading |\@empty| preserves braces, as does the trailing pattern.
4385 % \begin{macrocode}
4386 \expandafter\XC@repl@ce\expandafter\@empty #1\@empty#2Q{#3}}
4387 }
4388 % \end{macrocode}
4389 % \end{macro}
4390 %
4391 % \begin{macro}{\XC@clean}
4392 % \marg{cmd}\\
4393 % Makes a proper comma-separated list from \meta{cmd}'s contents and stores it again in \meta{cmd}.
4394 % Firstly, all commas are changed into spaces, secondly, `|. |' strings are changed to spaces.
4395 % Thirdly, non-trailing spaces are turned into commas (using a technique similar to \LaTeX's |\zap@space|).
4396 % Finally, the two leading commas are gobbled.
4397 % For example, `| 1 2. , 3 |' is mapped to `|1,2,3|'.
4398 % \begin{macrocode}
4399 \def\XC@clean#1%
4400 {\edef#1{ #1 }%
4401 \XC@cle@n#1,{ }\XC@cle@n#1{. }{ }\XC@cle@n#1{ },%
4402 \edef#1{\expandafter\@gobbletwo#1}}
4403 \def\XC@cle@n#1#2#3%
4404 {\def\XC@cl@@n##1#2##2{#3##1\ifx##2\@empty\else\expandafter\XC@cl@@n\fi##2}%
4405 \edef#1{\expandafter\XC@cl@@n#1#2\@empty}}%
4406 % \end{macrocode}
4407 % \end{macro}
4408 %
4409 %
4410 % \subsubsection{Scalar arithmetic}
4411 %
4412 % \begin{macro}{\rdivide}
4413 % \marg{dimension register}\marg{div}\\
4414 % Divides \Meta{dimension register} by a real number \Meta{div}, which may also be buried in a dimension (register), and stores the resulting rounded dimension in \Meta{dimension register}.
4415 % The denominator \Meta{div} is assumed to be non-zero.
4416 % \begin{macrocode}
4417 \def\rdivide#1#2%
4418 {\begingroup\toks@{#1}\edef\@@tmp{\noexpand\@tempdima\the#1}%
4419 \@defaultunits\@tempdimb=#2pt\relax\@nnil \@@tmp\relax
4420 \ifdim\@tempdima<\z@ \@tempdima-\@tempdima\def\@sign{-}\else
4421 \def\@sign{}\fi
4422 \ifdim\@tempdimb<\z@ \@tempdimb-\@tempdimb\edef\@sign{\@sign-}\fi
4423 \ifdim\@tempdima<.1\maxdimen \ifdim\@tempdimb<.01\maxdimen
4424 \lshift\@tempdima \lshift\@tempdimb \fi\fi
4425 \@tempcnta=\@tempdima \@tempcntb=\@tempdimb
4426 \count@=\@tempcnta \divide\count@\@tempcntb
4427 \edef\@@tmp{\number\count@.}%
4428 \@tempswatrue \@rdivide \@rdivide \@rdivide \@rdivide \@rdivide
4429 \@tempswafalse \@rdivide
4430 \dimen@\@@tmp\p@ \ifnum\count@>4\advance\dimen@1sp\fi
4431 \dimen@\@sign\dimen@
4432 \edef\@@tmp{\the\toks@\the\dimen@}%
4433 \expandafter\endgroup\@@tmp}
4434 % \end{macrocode}
4435 %
4436 % \begin{macrocode}
4437 \def\@rdivide
4438 {\multiply\count@\@tempcntb \advance\@tempcnta-\count@
4439 \multiply\@tempcnta10 \count@=\@tempcnta \divide\count@\@tempcntb
4440 \if@tempswa\edef\@@tmp{\@@tmp\number\count@}\fi}
4441 % \end{macrocode}
4442 % \end{macro}
4443 %
4444 % \begin{macro}{\rmultiply}
4445 % \marg{dimension register}\marg{dec}\\
4446 % Multiplies \Meta{dimension register} by \Meta{dec} and stores the resulting dimension in \Meta{dimension register}.
4447 % \begin{macrocode}
4448 \def\rmultiply#1#2%
4449 {\begingroup
4450 \edef\@@mul{#2}\@tempdima\the#1\relax
4451 \afterassignment\@tempdimb\@tempcntb=\@@mul\p@
4452 \ifdim\@tempdima<\z@ \@tempdima-\@tempdima\def\@sign{-}\else
4453 \def\@sign{}\fi
4454 \ifnum\@tempcntb<\z@ \@tempcntb-\@tempcntb\edef\@sign{\@sign-}\fi
4455 \lshift\@tempdima \dimen@\z@
4456 \expandafter\@rmultiply\@@mul.0.\@nil
4457 \advance\dimen@\@tempcntb\@tempdima \rshift\dimen@
4458 \dimen@\@sign\dimen@
4459 \edef\@@tmp{#1\the\dimen@}%
4460 \expandafter\endgroup\@@tmp}
4461 % \end{macrocode}
4462 %
4463 % \begin{macrocode}
4464 \def\@rmultiply#1.#2.#3\@nil
4465 {\def\@@tmp{}%
4466 \@tfor\@@mul:=#2\do
4467 {\edef\@@tmp
4468 {\advance\dimen@\@@mul\@tempdima \divide\dimen@10 \@@tmp}}%
4469 \@@tmp}
4470 % \end{macrocode}
4471 % \end{macro}
4472 %
4473 % \begin{macro}{\lshift}
4474 % \begin{macro}{\llshift}
4475 % \marg{dimension register}\\
4476 % Multiplies \Meta{dimension register} safely by 10 resp. 100.
4477 % \begin{macrocode}
4478 \def\lshift#1{#1\expandafter\lshift@\the#1}
4479 \def\llshift#1{\lshift#1\lshift#1}
4480 % \end{macrocode}
4481 % \end{macro}
4482 % \end{macro}
4483 %
4484 % \begin{macro}{\lshiftnum}
4485 % \begin{macro}{\llshiftnum}
4486 % \marg{decimal number}\\
4487 % Multiplies \Meta{decimal number} by 10 resp. 100.
4488 % \begin{macrocode}
4489 \def\lshiftnum#1{\expandafter\lshiftnum@#1.00.:}
4490 \def\lshiftnum@#1.#2#3.#4:{#1#2\ifnum0#3>\z@.#3\fi}
4491 \def\llshiftnum#1{\expandafter\llshiftnum@#1\@empty.00.:}
4492 \def\llshiftnum@#1.#2#3#4.#5:%
4493 {#1#2\ifnum0#3>\z@#3\else0\fi\ifnum0#4>\z@.#4\fi}
4494 % \end{macrocode}
4495 % \end{macro}
4496 % \end{macro}
4497 %
4498 % \begin{macro}{\lshiftset}
4499 % \begin{macro}{\llshiftset}
4500 % \marg{dimension register}\marg{decimal number}\\
4501 % Multiplies \Meta{decimal number} by 10 resp. 100 and puts it into \Meta{dimension register}.
4502 % \begin{macrocode}
4503 \def\lshiftset#1#2{\edef\@@XC{\noexpand\lshiftnum{#2}}#1\@@XC\p@}
4504 \def\llshiftset#1#2{\edef\@@XC{\noexpand\llshiftnum{#2}}#1\@@XC\p@}
4505 % \end{macrocode}
4506 % \end{macro}
4507 % \end{macro}
4508 %
4509 % \begin{macro}{\rshift}
4510 % \begin{macro}{\rrshift}
4511 % \marg{dimension register}\\
4512 % Divides \Meta{dimension register} safely by 10 resp. 100.
4513 % \begin{macrocode}
4514 \def\rshift#1{#1\expandafter\rshift@\the#1}
4515 \def\rrshift#1{\rshift#1\rshift#1}
4516 % \end{macrocode}
4517 % \end{macro}
4518 % \end{macro}
4519 %
4520 % \begin{macro}{\lshift}
4521 % \begin{macro}{\llshift}
4522 % \marg{dec}\\
4523 % Multiplies \Meta{dec}, which may be either a number or something like |\the\dimen@|, safely by 10 resp. 100.
4524 % The following definitions are similar to the way how |\strip@pt| is defined in the \LaTeX{} kernel.
4525 % \begin{macrocode}
4526 \begingroup
4527 \catcode`P=12
4528 \catcode`T=12
4529 \lowercase
4530 {\def\@@tmp{\def\lshift@##1.##2##3PT{##1##2\ifnum0##3>\z@.##3\fi\p@}
4531 \def\rshift@##1.##2PT{\rshift@@##1\relax##2\p@}}}
4532 \expandafter\endgroup\@@tmp
4533 % \end{macrocode}
4534 % \end{macro}
4535 % \end{macro}
4536 %
4537 % \begin{macrocode}
4538 \def\rshift@@#1#2%
4539 {\ifx#2\relax.#1\else#1\expandafter\rshift@@\expandafter#2\fi}
4540 % \end{macrocode}
4541 %
4542 %
4543 % \subsubsection{Vector arithmetic}
4544 %
4545 % \begin{macro}{\XC@inflate}
4546 % \marg{core model}\marg{first}\marg{second}\marg{cmd}\\
4547 % Constructs an 8-dimensional vector based on two vectors \Meta{first}, \Meta{second} (of common dimension $1,3,4$) and an underlying color model (stored in the macro \Meta{core model}).
4548 % The resulting vector is stored in \Meta{cmd}.
4549 % \begin{macrocode}
4550 \def\XC@inflate#1#2#3#4%
4551 {\edef#4{#2,\ifx#1\XC@mod@cmyk #3\else
4552 \ifx#1\XC@mod@gray ,,,#3,,,\else ,#3,\fi\fi}}
4553 % \end{macrocode}
4554 % \end{macro}
4555 %
4556 % \begin{macro}{\XC@vec}
4557 % \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
4558 % Generic vector calculation for two vectors (of common dimension $1,3,4$), puts the result into \Meta{cmd}.
4559 % \begin{macrocode}
4560 \def\XC@vec#1,#2,#3,#4,#5,#6,#7,#8,#9%
4561 {\def\@@tmp{}%
4562 \XC@vec@{#1}{#5}%
4563 \ifx,#2,\else
4564 \XC@vec@{#2}{#6}\XC@vec@{#3}{#7}\ifx,#4,\else\XC@vec@{#4}{#8}\fi\fi
4565 \aftergroupdef#9\@@tmp}
4566 % \end{macrocode}
4567 %
4568 % \begin{macrocode}
4569 \def\XC@vec@@{\edef\@@tmp{\ifx\@@tmp\@empty\else\@@tmp,\fi\strip@pt\dimen@}}
4570 % \end{macrocode}
4571 % \end{macro}
4572 %
4573 % \begin{macro}{\XC@add}
4574 % \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
4575 % Calculates the sum of two vectors (of common dimension $1,3,4$) and puts it into \Meta{cmd}.
4576 % \begin{macrocode}
4577 \def\XC@add{\begingroup \let\XC@vec@\XC@add@ \XC@vec}
4578 % \end{macrocode}
4579 %
4580 % \begin{macrocode}
4581 \def\XC@add@#1#2%
4582 {\llshiftset\dimen@{#1}\llshiftset\@tempdima{#2}%
4583 \advance\dimen@\@tempdima \rrshift\dimen@ \XC@vec@@}
4584 % \end{macrocode}
4585 % \end{macro}
4586 %
4587 % \begin{macro}{\XC@sub}
4588 % \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
4589 % Calculates the difference of two vectors (of common dimension $1,3,4$) and puts it into \Meta{cmd}.
4590 % \begin{macrocode}
4591 \def\XC@sub{\begingroup \let\XC@vec@\XC@sub@ \XC@vec}
4592 % \end{macrocode}
4593 %
4594 % \begin{macrocode}
4595 \def\XC@sub@#1#2{\XC@add@{#1}{-#2}}
4596 % \end{macrocode}
4597 % \end{macro}
4598 %
4599 % \begin{macro}{\XC@mul}
4600 % \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
4601 % Calculates the (component-wise) product of two vectors (of common dimension $1,3,4$) and puts it into \Meta{cmd}.
4602 % \begin{macrocode}
4603 \def\XC@mul{\begingroup \let\XC@vec@\XC@mul@ \XC@vec}
4604 % \end{macrocode}
4605 %
4606 % \begin{macrocode}
4607 \def\XC@mul@#1#2%
4608 {\llshiftset\dimen@{#1}\rmultiply\dimen@{#2}\rrshift\dimen@ \XC@vec@@}
4609 % \end{macrocode}
4610 % \end{macro}
4611 %
4612 % \begin{macro}{\XC@mix}
4613 % \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
4614 % Calculates the linear interpolation of two color parameter vectors and puts it into \Meta{cmd}.
4615 % The percentage parameter $p$ is input via register |\dimen@|.
4616 % \begin{macrocode}
4617 \def\XC@mix%
4618 {\begingroup
4619 \@tempdima\dimen@ \@tempdimb100\p@ \advance\@tempdimb-\@tempdima
4620 \let\XC@vec@\XC@mix@ \XC@vec}
4621 % \end{macrocode}
4622 %
4623 % \begin{macrocode}
4624 \def\XC@mix@#1#2%
4625 {\dimen@#1\@tempdima \advance\dimen@#2\@tempdimb \rrshift\dimen@ \XC@vec@@}
4626 % \end{macrocode}
4627 % \end{macro}
4628 %
4629 %
4630 % \begin{macro}{\XC@calc@}
4631 % \Meta{x}|,|\Meta{y}|,|\Meta{z}|,|\Meta{w}|,|\Meta{dummy}|:|\marg{function}\\
4632 % Performs, dependent on the number of non-empty parameters, |\edef\@@tmp{|$f(x)$|}| or |\edef\@@tmp{|$f(x),f(y),f(z)$|}| or |\edef\@@tmp{|$f(x),f(y),f(z),f(w)$|}|, where the function $f$ is determined by the parameter \Meta{function}.
4633 % \begin{macrocode}
4634 \def\XC@calc@#1,#2,#3,#4,#5:#6%
4635 {\XC@let@Nc\@@cmd{XC@calc#6}\@@cmd{#1}\@@tmp
4636 \ifx,#2,\else
4637 \@@cmd{#2}\@tempa\@@cmd{#3}\@tempb
4638 \ifx,#4,%
4639 \edef\@@tmp{\@@tmp,\@tempa,\@tempb}\else
4640 \@@cmd{#4}\@tempc\edef\@@tmp{\@@tmp,\@tempa,\@tempb,\@tempc}\fi\fi}
4641 % \end{macrocode}
4642 % \end{macro}
4643 %
4644 % \begin{macro}{\XC@calcC}
4645 % \marg{x}\marg{cmd}\\
4646 % \textbf Complement of $x$: performs |\def|\Meta{cmd}|{|$1-x$|}|.
4647 % Yields exact results for all numbers within $[0,1]$ with 5 decimal digits.
4648 % \begin{macrocode}
4649 \def\XC@calcC#1#2%
4650 {\llshiftset\dimen@{-#1}\advance\dimen@100\p@
4651 \rrshift\dimen@ \XC@calcN{\strip@pt\dimen@}#2}
4652 % \end{macrocode}
4653 % \end{macro}
4654 %
4655 % \begin{macro}{\XC@calcD}
4656 % \marg{x}\marg{cmd}\\
4657 % \textbf Division of $x$ by $s$: performs |\def|\Meta{cmd}|{|$x/s$|}|.
4658 % The parameter $s$ is input via |\@@scl|.
4659 % \begin{macrocode}
4660 \def\XC@calcD{\XC@c@lcD\@@scl{}}
4661 % \end{macrocode}
4662 % \end{macro}
4663 %
4664 % \begin{macro}{\XC@c@lcD}
4665 % \marg{s}\marg{string}\marg{x}\marg{cmd}\\
4666 % \textbf Division of $x$ by $s$, appending \Meta{string}: performs |\def|\Meta{cmd}|{|$x/s$\Meta{string}|}|.
4667 % \begin{macrocode}
4668 \def\XC@c@lcD#1#2#3#4%
4669 {\dimen@#3\p@ \rdivide\dimen@{#1}\edef#4{\strip@pt\dimen@#2}}
4670 % \end{macrocode}
4671 % \end{macro}
4672 %
4673 % \begin{macro}{\XC@calcF}
4674 % \marg{x}\marg{cmd}\\
4675 % \textbf Format $x$ with 5 decimals, no range checks.
4676 % \begin{macrocode}
4677 \def\XC@calcF#1#2%
4678 {\edef#2{#1}\expandafter\XC@c@lcF#2.0.:#2}
4679 % \end{macrocode}
4680 %
4681 % Special treatment of integer part because of so many possible variations ($---.0$, $7$, \dots).
4682 % \begin{macrocode}
4683 \def\XC@c@lcF#1.#2.#3:#4%
4684 {\edef#4{\XC@c@@cR#200000:}%
4685 \dimen@#1.5\p@ \afterassignment\dimen@\count@=\the\dimen@
4686 \edef#4%
4687 {\ifnum#4>0 \ifnum\count@=0 \ifdim#1.5\p@<\z@ -\fi\fi\fi
4688 \number\count@.#4}}
4689 % \end{macrocode}
4690 % \end{macro}
4691 %
4692 % \begin{macro}{\XC@calcH}
4693 % \marg{x}\marg{cmd}\\
4694 % \textbf Hexadecimal transformation of $x\in\{0,1,\dots,255\}$: performs |\def|\Meta{cmd}|{|$x_{16}$|}|.
4695 % \begin{macrocode}
4696 \def\XC@calcH#1#2%
4697 {\count@#1 \divide\count@\sixt@@n \edef\XC@@tmp{\hexnumber@\count@}%
4698 \multiply\count@-\sixt@@n \advance\count@#1
4699 \edef#2{\XC@@tmp\hexnumber@\count@}}
4700 % \end{macrocode}
4701 % \end{macro}
4702 %
4703 % \begin{macro}{\XC@calcM}
4704 % \marg{x}\marg{cmd}\\
4705 % \textbf Multiplication of $x$ by $s$ plus rounding: performs |\def|\Meta{cmd}|{|$[s\cdot x+0.5]$|}|.
4706 % The parameter $s$ is input via |\@@scl|.
4707 % \begin{macrocode}
4708 \def\XC@calcM#1#2%
4709 {\dimen@#1\p@ \dimen@\@@scl\dimen@ \advance\[email protected]\p@
4710 \afterassignment\dimen@\count@=\the\dimen@ \edef#2{\number\count@}}
4711 % \end{macrocode}
4712 % \end{macro}
4713 %
4714 % \begin{macro}{\XC@calcN}
4715 % \marg{x}\marg{cmd}\\
4716 % \textbf Normalisation of $x$: similar to |\XC@calcR|, but trailing zeros are eliminated.
4717 % \begin{macrocode}
4718 \def\XC@calcN#1#2%
4719 {\XC@calcR{#1}#2\edef#2{\expandafter\XC@c@lcN#200000:}}
4720 % \end{macrocode}
4721 %
4722 % Gobble trailing zeros.
4723 % \begin{macrocode}
4724 \def\XC@c@lcN#1.#200000#3:{#1\ifnum0#2=0 \else.#2\fi}
4725 % \end{macrocode}
4726 % \end{macro}
4727 %
4728 % \begin{macro}{\XC@calcR}
4729 % \marg{x}\marg{cmd}\\
4730 % \textbf Reduction of $x$ to the unit interval: performs |\def|\Meta{cmd}|{|$\min\{1,\max\{0,x\}\}$|}|.
4731 % Numbers are output with 5 decimals.
4732 % This could also be done using |\XC@calcF|, followed by a range check, but perhaps less efficiently.
4733 % \begin{macrocode}
4734 \def\XC@calcR#1#2{\edef#2{#1}\edef#2{\expandafter\XC@c@lcR#2.0.:}}
4735 % \end{macrocode}
4736 %
4737 % Check interval.
4738 % \begin{macrocode}
4739 \def\XC@c@lcR#1.#2.#3:%
4740 {\ifnum#10>0 1.00000\else 0.\ifnum#11<0 00000\else
4741 \XC@c@@cR#200000:\fi\fi}
4742 % \end{macrocode}
4743 %
4744 % Normalize to 5 digits.
4745 % \begin{macrocode}
4746 \def\XC@c@@cR#1#2#3#4#5#6:{#1#2#3#4#5}
4747 % \end{macrocode}
4748 % \end{macro}
4749 %
4750 % \begin{macro}{\XC@calcS}
4751 % \marg{x}\marg{cmd}\\
4752 % \textbf Scaling of $x$ by $s$: performs |\def|\Meta{cmd}|{|$s\cdot x$|}|.
4753 % The parameter $s$ is input via |\@@scl|.
4754 % \begin{macrocode}
4755 \def\XC@calcS{\XC@c@lcS\@@scl{}}
4756 % \end{macrocode}
4757 % \end{macro}
4758 %
4759 % \begin{macro}{\XC@c@lcS}
4760 % \marg{s}\marg{string}\marg{x}\marg{cmd}\\
4761 % \textbf Scaling of $x$ by $s$, appending \Meta{string}: performs |\def|\Meta{cmd}|{|$s\cdot x$\Meta{string}|}|.
4762 % \begin{macrocode}
4763 \def\XC@c@lcS#1#2#3#4%
4764 {\lshiftset\dimen@{#3}%
4765 \ifdim#1\p@<100\p@
4766 \dimen@\lshiftnum#1\dimen@ \rrshift\dimen@ \else
4767 \dimen@#1\dimen@ \rshift\dimen@ \fi
4768 \edef#4{\strip@pt\dimen@#2}}
4769 % \end{macrocode}
4770 % \end{macro}
4771 %
4772 % \begin{macro}{\XC@calcT}
4773 % \marg{x}\marg{cmd}\\
4774 % \textbf Translate $x$ by $a$ and cut to unit interval: performs |\def|\Meta{cmd}|{|$\min\{1,\max\{0,x+a\}\}$|}|.
4775 % The parameter $a$ is input via |\@@arg|.
4776 % \begin{macrocode}
4777 \def\XC@calcT#1#2%
4778 {\lshiftset\dimen@{#1}\advance\dimen@\lshiftnum\@@arg\p@ \rshift\dimen@
4779 \edef#2%
4780 {\ifdim\dimen@>\p@1\else\ifdim\dimen@<\z@0\else\strip@pt\dimen@\fi\fi}}
4781 % \end{macrocode}
4782 % \end{macro}
4783 %
4784 % \begin{macro}{\XC@calcU}
4785 % \marg{x}\marg{cmd}\\
4786 % \textbf Unit interval mapping of $x$: performs |\def|\Meta{cmd}|{|$x-[x]$|}| if $x\neq1$, $1$ otherwise.
4787 % \begin{macrocode}
4788 \def\XC@calcU#1#2%
4789 {\dimen@#1\p@
4790 \ifdim\dimen@=\p@\else
4791 \afterassignment\dimen@\count@=\the\dimen@
4792 \relax\ifdim\dimen@=\z@\else
4793 \ifdim#1\p@<\z@ \dimen@-\dimen@ \advance\dimen@\p@ \fi
4794 \fi
4795 \fi
4796 \edef#2{\strip@pt\dimen@}}
4797 % \end{macrocode}
4798 % \end{macro}
4799 %
4800 %
4801 % \subsection{Color definition}
4802 %
4803 % \subsubsection{Constants}
4804 %
4805 % \begin{macro}{\rangeRGB}
4806 % \begin{macro}{\rangeHSB}
4807 % \begin{macro}{\rangeHsb}
4808 % \begin{macro}{\rangetHsb}
4809 % \begin{macro}{\rangeGray}
4810 % Scaling ranges for `integer' and other special models:
4811 % \begin{macrocode}
4812 \providecommand*\rangeRGB{255}
4813 \providecommand*\rangeHSB{240}
4814 \providecommand*\rangeHsb{360}
4815 \providecommand*\rangetHsb{60,30;120,60;180,120;210,180;240,240}
4816 \providecommand*\rangeGray{15}
4817 % \end{macrocode}
4818 % \end{macro}
4819 % \end{macro}
4820 % \end{macro}
4821 % \end{macro}
4822 % \end{macro}
4823 %
4824 % \begin{macro}{\adjustUCRBG}
4825 % Parameters for undercolor-removal (UCR) and black-generation (BG) during \Model{cmy} to \Model{cmyk} conversion:
4826 % \begin{macrocode}
4827 \providecommand*\adjustUCRBG{1,1,1,1}
4828 % \end{macrocode}
4829 % \end{macro}
4830 %
4831 % \begin{macro}{\paperquality}
4832 % Parameter for choosing different color sets according to the paper quality; yet supported only for the HKS colors.
4833 % \begin{macrocode}
4834 \providecommand*\paperquality{1}
4835 % \end{macrocode}
4836 % \end{macro}
4837 %
4838 % \begin{macro}{\colorseriescycle}
4839 % Default cycle length for color series:
4840 % \begin{macrocode}
4841 \providecommand*\colorseriescycle{16}
4842 % \end{macrocode}
4843 % \end{macro}
4844 %
4845 % Model-dependent base colors:
4846 % \begin{macrocode}
4847 \def\XC@clr@rgb@white{1,1,1}
4848 \def\XC@clr@cmy@white{0,0,0}
4849 \def\XC@clr@cmyk@white{0,0,0,0}
4850 \def\XC@clr@hsb@white{\@@hue,0,1}
4851 \def\XC@clr@hsb@gray{\@@hue,0,0.5}
4852 \def\XC@clr@hsb@black{\@@hue,0,0}
4853 \def\XC@clr@gray@white{1}
4854 % \end{macrocode}
4855 %
4856 % \begin{macro}{\XC@met@grad}
4857 % \begin{macro}{\XC@met@last}
4858 % \begin{macro}{\XC@met@step}
4859 % Methods for color series:
4860 % \begin{macrocode}
4861 \@tfor\@@tmp:={grad}{last}{step}\do
4862 {\XC@let@cN{XC@met@\@@tmp}\@@tmp}
4863 % \end{macrocode}
4864 % \end{macro}
4865 % \end{macro}
4866 % \end{macro}
4867 %
4868 %
4869 % \subsubsection{Colors}\label{sec.definition}
4870 %
4871 % \begin{macro}{\definecolor}
4872 % \oarg{type}\marg{name}\oarg{prefix}\marg{model-list}\marg{spec-list}\\
4873 % Extends the facilities of \LC's |\definecolor|.
4874 % The optional argument \Meta{type} has currently to be either empty (= normal color definition) or `named' or `ps'.
4875 % \Meta{prefix} is an argument used for the internal driver-dependent representation.
4876 % |\definecolor| creates a new command |\\color@|\Meta{name} that contains the \emph{internal representation}
4877 % |\xcolor@|\marg{type-spec}\marg{driver-spec}\marg{n-model}\marg{n-color-spec} of the color, where
4878 % \begin{itemize}
4879 % \item \Meta{type-spec} is either empty (if \Meta{type} was empty), or a driver-dependent macro or expression (if \Meta{type} was `named', `ps');
4880 % \item \Meta{driver-spec} is a driver-dependent representation of the color, which also depends on \Meta{type};
4881 % \item \Meta{n-model} is either \Meta{model} or the name of another color model, dependent on the desired transformation(s) at definition time;
4882 % \item \Meta{n-color-spec} are the comma-separated normalised parameter values of the color with respect to \Meta{n-model}.
4883 % \end{itemize}
4884 % See table \vref{tab.internal} for some examples.
4885 % \begin{macrocode}
4886 \protected\def\definecolor{\@testopt{\XC@definecolor}{}}
4887 \def\XC@definecolor[#1]#2%
4888 {\@testopt{\XC@definec@lor[#1]{#2}}\colornameprefix}
4889 % \end{macrocode}
4890 % \begin{macrocode}
4891 \def\XC@definec@lor[#1]#2[#3]#4#5%
4892 {%
4893 \begingroup
4894 \XC@sdef\@@cls{#1}\XC@edef\@@nam{#2}\edef\colornameprefix{#3}%
4895 \XC@logdef\@@nam
4896 \XC@getmodclr02{#4}{#5}{\let\@@tmp\relax}%
4897 {\ifx\@@mod\XC@mod@named
4898 \XC@c@l@rlet\@@nam\@@clr
4899 \else
4900 \ifx\@@cls\XC@mod@ps
4901 \edef\@@drv{\@@mod\space\@@clr}\def\@@hue{0}%
4902 \edef\@@clr{\@nameuse{XC@clr@\@@mod @white}}%
4903 \else
4904 \ifconvertcolorsD
4905 \let\@@tmp\@@mod\XC@sdef\@@mod{\XC@tgt@mod\@@tmp}%
4906 \convertcolorspec\@@tmp\@@clr\@@mod\@@clr
4907 \fi
4908 \XC@coremodel\@@mod\@@clr
4909 % \end{macrocode}
4910 %
4911 % Determine driver-dependent color definition:
4912 % \begin{macrocode}
4913 \csname color@\@@mod\expandafter\endcsname
4914 \expandafter\@@drv\expandafter{\@@clr}%
4915 % \end{macrocode}
4916 %
4917 % Handle prologue and `named' colors:
4918 % \begin{macrocode}
4919 \ifcase\XC@@xcp@
4920 \immediate\write\XC@@xcp{/\colornameprefix\@@nam{\expandafter
4921 \XC@strip@comma\@@clr,,\@nnil}XC\@@mod}%
4922 \let\@@cls\XC@mod@named
4923 \fi
4924 \ifx\@@cls\@empty\else
4925 \let\@@tmp\@@cls
4926 \@nameuse{define@color@\@@cls}\@@nam\@@drv
4927 \csname color@\@@tmp\expandafter\endcsname
4928 \expandafter\@@drv\expandafter{\@@nam}%
4929 \fi
4930 \fi
4931 % \end{macrocode}
4932 %
4933 % Finally write all information into macro |\\color@|\Meta{name}:
4934 % \begin{macrocode}
4935 \toks@\expandafter{\@@drv}%
4936 \edef\@@tmp
4937 {\ifglobalcolors\global\else\xglobal@\fi
4938 \noexpand\@namedef{\@backslashchar color@\@@nam}%
4939 {\noexpand\xcolor@{\@@cls}{\the\toks@}{\@@mod}{\@@clr}}}%
4940 \fi}%
4941 \expandafter\endgroup\@@tmp\xglobal@stop}
4942 % \end{macrocode}
4943 % \end{macro}
4944 %
4945 % \begin{macro}{\XC@getmodclr}
4946 % \marg{mod-opt}\marg{clr-opt}\marg{model-list}\marg{spec-list}\marg{undefined}\marg{defined}\\
4947 % Depending on \Meta{mod-opt}, different tasks are performed:
4948 % \begin{itemize}
4949 % \item[0:] Retrieve color model and target model from \Meta{model-list} if |\XC@@getmod| is `true'.
4950 % \item[1:] Retrieve color model and target model from \Meta{model-list} always.
4951 % \end{itemize}
4952 % The color model is stored in |\@@mod|, its position in |\XC@@pos|, a possible target model in |\@@Mod|.
4953 % Depending on \Meta{clr-opt}, different tasks are performed:
4954 % \begin{itemize}
4955 % \item[0:] Don't pick color specification from \Meta{spec-list}.
4956 % \item[1:] Pick color specification from \Meta{spec-list}, convert it from model |\@@mod| to |\@@Mod|, unless the latter is `ignore' or |\@@cls| is `ps'.
4957 % \item[2:] Like the former case, additionally |\let\@@mod\@@Mod|.
4958 % \end{itemize}
4959 % The color specification is stored in |\@@clr|.
4960 % Color specification picking relies on the position |\XC@@pos|, conversion relies on the model |\@@mod|, and the target model |\@@Mod|.
4961 % If |\@@mod| represents an undefined color model, then \Meta{undefined} is executed at the end of the macro, else \Meta{defined}.
4962 % \begin{macrocode}
4963 \def\XC@getmodclr#1#2#3#4%
4964 {\ifnum\ifcase#1 \ifXC@@getmod1\else0 \fi \or1 \fi>0
4965 \XC@mdef\@@mod{#3}\expandafter\XC@getmod\@@mod////////\XC@@
4966 \@ifundefinedmodel\@@Mod{\let\@@Mod\XC@mod@ignore}{}\fi
4967 \@ifundefined{XC@mod@\@@mod}%
4968 {\c@lor@error{model `\@@mod'}\@firstoftwo}%
4969 {\ifcase#2\else
4970 \XC@mdef\@@clr{#4}%
4971 \edef\@@clr{\expandafter\XC@getclr\@@clr////////\XC@@}%
4972 \ifx\@@cls\XC@mod@ps\else\XC@clean\@@clr\fi
4973 \ifx\@@Mod\XC@mod@ignore\else
4974 \convertcolorspec\@@mod\@@clr\@@Mod\@@clr
4975 \ifnum#2>1 \let\@@mod\@@Mod\fi
4976 \fi
4977 \fi \@secondoftwo}}
4978 % \end{macrocode}
4979 %
4980 % \begin{macro}{\XC@getmod}
4981 % Retrieve model position |\XC@@pos|, model |\@@mod|, and target model |\@@Mod| from multiple definitions (up to~8), separated by `|/|'.
4982 % \begin{macrocode}
4983 \def\XC@getmod#1/#2/#3/#4/#5/#6/#7/#8/#9\XC@@
4984 {\def\XC@dflt@@mod{#1}%
4985 \XC@g@tm@d0#1::\XC@@ \XC@getm@d1{#2}\XC@getm@d2{#3}%
4986 \XC@getm@d3{#4}\XC@getm@d4{#5}\XC@getm@d5{#6}\XC@getm@d6{#7}%
4987 \XC@getm@d7{#8}\def\XC@@pos{0}\let\@@mod\XC@dflt@@mod\@gobble\@nnil}%
4988 % \end{macrocode}
4989 %
4990 % \begin{macrocode}
4991 \def\XC@getm@d#1#2%
4992 {\edef\XC@@pos{#2}\XC@sdef\@@mod{\XC@tgt@mod\XC@@pos}%
4993 \ifx\XC@@pos\@@mod\def\XC@@pos{#1}\expandafter\remove@to@nnil\fi}%
4994 % \end{macrocode}
4995 %
4996 % \begin{macrocode}
4997 \def\XC@g@tm@d#1#2:#3:#4\XC@@
4998 {\@ifxempty{#3}{\let\@@Mod\XC@mod@ignore\XC@getm@d0{#2}}%
4999 {\def\@@Mod{#2}%
5000 \def\XC@tgt@mod##1{#2}%
5001 \def\XC@dflt@@mod{#3}%
5002 \XC@getm@d0{#3}}}%
5003 % \end{macrocode}
5004 % \end{macro}
5005 %
5006 % \begin{macro}{\XC@getclr}
5007 % Pick color specification on position |\XC@@pos| from multiple definitions (up to~8), separated by `|/|'.
5008 % Expandable.
5009 % \begin{macrocode}
5010 \def\XC@getclr#1/#2/#3/#4/#5/#6/#7/#8/#9\XC@@
5011 {\ifcase\XC@@pos\space #1\or#2\or#3\or#4\or#5\or#6\or#7\or#8\fi}
5012 % \end{macrocode}
5013 % \end{macro}
5014 %
5015 % \begin{macro}{\ifXC@@getmod}
5016 % Switch used to determine whether the model has to be retrieved (e.g., ordinary |\definecolor|) or not (e.g., |\definecolor| acting as subroutine to |\definecolorset|).
5017 % \begin{macrocode}
5018 \newif\ifXC@@getmod \XC@@getmodtrue
5019 % \end{macrocode}
5020 % \end{macro}
5021 % \end{macro}
5022 %
5023 % \begin{macro}{\xdefinecolor}
5024 % This command is identical with |\definecolor|, it is kept only for compatibility reasons.
5025 % \begin{macrocode}
5026 \let\xdefinecolor\definecolor
5027 % \end{macrocode}
5028 % \end{macro}
5029 %
5030 % \begin{macro}{\providecolor}
5031 % \oarg{type}\marg{name}\marg{model-list}\marg{spec-list}\\
5032 % Similar to |\definecolor|, but the color \Meta{name} is only defined if it does not exist already.
5033 % \begin{macrocode}
5034 \def\providecolor{\@testopt{\XC@providecolor}{}}
5035 \def\XC@providecolor[#1]#2%
5036 {\@testopt{\XC@providec@lor[#1]{#2}}\colornameprefix}
5037 % \end{macrocode}
5038 %
5039 % \begin{macrocode}
5040 \def\XC@providec@lor[#1]#2[#3]%
5041 {\XC@edef\XC@@tmp{#2}%
5042 \@ifundefinedcolor\XC@@tmp{\XC@definecolor[#1]{#2}[#3]}%
5043 {\ifnum\XC@tracing>0
5044 \PackageInfo{xcolor}{Ignoring color definition `\XC@@tmp'}\fi
5045 \@gobbletwo}}
5046 % \end{macrocode}
5047 % \end{macro}
5048 %
5049 % \begin{macro}{\xcolor@}
5050 % \marg{type-spec}\marg{driver-spec}\marg{model}\marg{spec}\\
5051 % Simply grabs the driver-specific part of the color definition.
5052 % Therefore, the command |\\color@|\Meta{name} behaves like in the original case, when first-level expanded.
5053 % \begin{macrocode}
5054 \def\xcolor@#1#2#3#4{#2}
5055 % \end{macrocode}
5056 % \end{macro}
5057 %
5058 % \begin{macro}{\colorlet}
5059 % \oarg{type}\marg{name}\oarg{num model}\marg{color}\\
5060 % Create a color `name' consisting of \Meta{color}, converted to \Meta{num model} if non-empty.
5061 % \begin{macrocode}
5062 \def\colorlet{\@testopt{\XC@colorlet}{}}
5063 \def\XC@colorlet[#1]#2{\@testopt{\XC@col@rlet[#1]{#2}}{}}
5064 \def\XC@col@rlet[#1]#2[#3]#4%
5065 {\begingroup
5066 \edef\@@cls{#1}\XC@edef\@@nam{#2}\XC@sdef\@@mod{#3}\XC@edef\@@clr{#4}%
5067 % \end{macrocode}
5068 %
5069 % Check whether |#4| is an explicit name, |#3| is empty and |#1| is either empty or equal to the corresponding parameter of |#4|: in this case, a simple |\let| command will do the job.
5070 % \begin{macrocode}
5071 \XC@info\@@clr\@@tmp\XC@@tstfalse
5072 \ifnum\@@tmp=\@ne\ifx\@@mod\@empty
5073 \ifx\@@cls\@empty
5074 \XC@@tsttrue
5075 \else
5076 \edef\@@tmp
5077 {\expandafter\expandafter\expandafter\@secondoffive
5078 \csname\@backslashchar color@\@@clr\endcsname}%
5079 \ifx\@@cls\@@tmp\XC@@tsttrue\fi
5080 \fi
5081 \fi\fi
5082 \ifXC@@tst
5083 \XC@logdef\@@nam\XC@c@l@rlet\@@nam\@@clr
5084 \else
5085 \extractcolorspec\@@clr\@@clr
5086 \ifx\@@mod\@empty\else
5087 \expandafter\convertcolorspec\@@clr\@@mod\@@clr
5088 \edef\@@clr{{\@@mod}{\@@clr}}\fi
5089 \edef\@@tmp{\noexpand\XC@definecolor[\@@cls]{\@@nam}\@@clr}%
5090 \fi
5091 \expandafter\endgroup\@@tmp\xglobal@stop}
5092 % \end{macrocode}
5093 %
5094 % \begin{macrocode}
5095 \def\XC@c@l@rlet#1#2%
5096 {\@ifundefinedcolor{#2}%
5097 {\c@lor@error{`#2'}\let\@@tmp\@empty}%
5098 {\edef\@@tmp
5099 {\ifglobalcolors\global\else\xglobal@\fi
5100 \noexpand\XC@let@cc{\@backslashchar color@#1}{\@backslashchar color@#2}}}}
5101 % \end{macrocode}
5102 % \end{macro}
5103 %
5104 % \begin{macro}{\DefineNamedColor}
5105 % \marg{type}\marg{name}\marg{model-list}\marg{spec-list}
5106 % \begin{macrocode}
5107 \protected\def\DefineNamedColor#1%
5108 {\@nameuse{XC@\ifdefinecolors defin\else prepar\fi ecolor}[#1]}
5109 % \end{macrocode}
5110 % \end{macro}
5111 %
5112 %
5113 % \subsubsection{Deferred definition}
5114 %
5115 % \begin{macro}{\preparecolor}
5116 % \oarg{type}\marg{name}\oarg{prefix}\marg{model-list}\marg{spec-list}\\
5117 % \begin{macrocode}
5118 \def\preparecolor{\@testopt{\XC@preparecolor}{}}
5119 \def\XC@preparecolor[#1]#2%
5120 {\@testopt{\XC@preparec@lor[#1]{#2}}\colornameprefix}
5121 % \end{macrocode}
5122 %
5123 % \begin{macrocode}
5124 \def\XC@preparec@lor[#1]#2[#3]#4#5%
5125 {\XC@sdef\@@cls{#1}\XC@edef\@@nam{#2}%
5126 \XC@getmodclr01{#4}{#5}{}%
5127 {\xdef\XC@@stack
5128 {\ifx\XC@@stack\@empty\else\XC@@stack,\fi{#1}{\@@nam}{#3}%
5129 {\ifx\@@Mod\XC@mod@ignore\@@mod\else\@@Mod\fi}{\@@clr}}}}
5130 % \end{macrocode}
5131 %
5132 % \begin{macrocode}
5133 \let\XC@@stack\@empty
5134 % \end{macrocode}
5135 % \end{macro}
5136 %
5137 % \begin{macro}{\definecolors}
5138 % \marg{id-list}
5139 % \begin{macrocode}
5140 \def\definecolors#1%
5141 {\let\XC@@cmd\definecolor\let\XC@@glb\xglobal@
5142 \expandafter\XC@definecolors#1,,}
5143 % \end{macrocode}
5144 %
5145 % \begin{macrocode}
5146 \def\XC@definecolors#1,%
5147 {\@ifxempty{#1}{}{\expandafter\XC@definec@lors#1=#1=:\XC@definecolors}}
5148 % \end{macrocode}
5149 %
5150 % \begin{macrocode}
5151 \def\XC@definec@lors#1=#2=#3:%
5152 {\XC@edef\@@nam{#1}\XC@edef\@@arg{#2}%
5153 \let\next\XC@definec@l@rs\expandafter\next\XC@@stack,,\@nnil}
5154 % \end{macrocode}
5155 %
5156 % \begin{macrocode}
5157 \def\XC@definec@l@rs#1,%
5158 {\ifx,#1,\let\next\remove@to@nnil\else\XC@defin@c@l@rs#1\fi\next}
5159 % \end{macrocode}
5160 %
5161 % \begin{macrocode}
5162 \def\XC@defin@c@l@rs#1#2#3#4#5%
5163 {\def\@@tmp{#2}%
5164 \ifx\@@tmp\@@arg
5165 \let\xglobal@\XC@@glb\XC@@cmd[#1]{\@@nam}[#3]{#4}{#5}%
5166 \let\next\remove@to@nnil
5167 \fi}
5168 % \end{macrocode}
5169 % \end{macro}
5170 %
5171 % \begin{macro}{\providecolors}
5172 % \marg{id-list}\\
5173 % Similar to |\definecolor|, but based on |\providecolor|, thus the individual colors are defined only if they do not exist already.
5174 % \begin{macrocode}
5175 \def\providecolors#1%
5176 {\let\XC@@cmd\providecolor\let\XC@@glb\xglobal@
5177 \expandafter\XC@definecolors#1,,}
5178 % \end{macrocode}
5179 % \end{macro}
5180 %
5181 %
5182 % \subsubsection{Sets of colors}
5183 %
5184 % \begin{macro}{\definecolorset}
5185 % \oarg{type}\marg{model-list}\marg{head}\marg{tail}\marg{set spec}\\
5186 % This command facilitates the construction of \emph{color sets} with common underlying \Meta{model-list} and \Meta{type}.
5187 % Here, \Meta{set spec} = \Meta[1]{name},\Meta[1]{spec-list};\dots;\Meta[k]{name},\Meta[k]{spec-list} ($k\ge1$ name/specification-list pairs).
5188 % Individual colors are being constructed by |\definecolor|\oarg{type}|{|\Meta{head}\Meta[1]{name}\Meta{tail}|}|\marg{model-list}|{|\Meta[1]{spec-list}|}| etc.
5189 % \begin{macrocode}
5190 \def\definecolorset
5191 {\let\XC@@cmd\definecolor\@testopt{\XC@definecolorset}{}}
5192 % \end{macrocode}
5193 %
5194 % \begin{macrocode}
5195 \def\XC@definecolorset[#1]#2#3#4#5%
5196 {\XC@getmodclr10{#2}{}{}%
5197 {\XC@@getmodfalse\XC@edef\XC@@tmp{#5}\let\XC@@glb\xglobal@
5198 \def\XC@definec@lorset##1,##2;%
5199 {\@ifxempty{##1}{}%
5200 {\let\xglobal@\XC@@glb
5201 \XC@@cmd[#1]{#3##1#4}{\@@mod}{##2}\XC@definec@lorset}}%
5202 \expandafter\XC@definec@lorset\XC@@tmp;,;\XC@@getmodtrue}}
5203 % \end{macrocode}
5204 % \end{macro}
5205 %
5206 % \begin{macro}{\providecolorset}
5207 % \oarg{type}\marg{model-list}\marg{name-prefix}\marg{name-postfix}\marg{set spec}\\
5208 % Similar to |\definecolorset|, but based on |\providecolor|, thus the individual colors are defined only if they do not exist already.
5209 % \begin{macrocode}
5210 \def\providecolorset
5211 {\let\XC@@cmd\providecolor\@testopt{\XC@definecolorset}{}}
5212 % \end{macrocode}
5213 % \end{macro}
5214 %
5215 % \begin{macro}{\preparecolorset}
5216 % \oarg{type}\marg{model-list}\marg{name-prefix}\marg{name-postfix}\marg{set spec}\\
5217 % Similar to |\definecolorset|, but dependent on |\ifdefinecolors|, either a |\definecolor| or a |\preparecolor| command will be executed for each single set member.
5218 % \begin{macrocode}
5219 \def\preparecolorset
5220 {\ifdefinecolors\let\XC@@cmd\definecolor\else\let\XC@@cmd\preparecolor\fi
5221 \@testopt{\XC@definecolorset}{}}
5222 % \end{macrocode}
5223 % \end{macro}
5224 %
5225 %
5226 % \subsubsection{Color series}
5227 %
5228 % \begin{macro}{\definecolorseries}
5229 % \marg{name}\marg{core model}\marg{method}\oarg{b-model}\marg{base color}\oarg{l-model}\marg{delta}
5230 % \begin{macrocode}
5231 \def\definecolorseries#1#2#3%
5232 {\@testopt{\XC@definecolorseries{#1}{#2}{#3}}{}}
5233 % \end{macrocode}
5234 %
5235 % \begin{macrocode}
5236 \def\XC@definecolorseries#1#2#3[#4]#5%
5237 {\@testopt{\XC@definec@lorseries{#1}{#2}{#3}[#4]{#5}}{}}
5238 % \end{macrocode}
5239 %
5240 % \begin{macrocode}
5241 \def\XC@definec@lorseries#1#2#3[#4]#5[#6]#7%
5242 {\begingroup
5243 \XC@sdef\@@mod{#2}%
5244 \@ifxempty{#4}{\extractcolorspec{#5}\@@clr}{\edef\@@clr{{#4}{#5}}}%
5245 \expandafter\convertcolorspec\@@clr\@@mod\@@clr
5246 \@namexdef{\@backslashchar colorB@#1}{{\@@mod}{\@@clr}}%
5247 \edef\@@met{#3}%
5248 \ifx\@@met\XC@met@last
5249 \@ifxempty{#6}{\extractcolorspec{#7}\@@tmp}{\edef\@@tmp{{#6}{#7}}}%
5250 \expandafter\convertcolorspec\@@tmp\@@mod\@@tmp
5251 \XC@inflate\@@mod\@@tmp\@@clr\@@tmp
5252 \expandafter\XC@sub\@@tmp,\@@tmp
5253 \else
5254 \edef\@@tmp{#7}%
5255 \fi
5256 \@namexdef{\@backslashchar colorD@#1}{{\@@met}{\@@tmp}}%
5257 \endgroup}
5258 % \end{macrocode}
5259 % \end{macro}
5260 %
5261 % \begin{macro}{\resetcolorseries}
5262 % \oarg{div}\marg{name}
5263 % \begin{macrocode}
5264 \def\resetcolorseries{\@testopt{\XC@resetcolorseries}{}}
5265 \def\XC@resetcolorseries[#1]#2%
5266 {\begingroup
5267 \@namexdef
5268 {\@backslashchar color@#2}{\noexpand\xcolor@{}{}\@nameuse{\@backslashchar colorB@#2}}%
5269 \XC@let@Nc\@@tmp{\@backslashchar colorD@#2}%
5270 \edef\@@met{\expandafter\@firstoftwo\@@tmp}%
5271 \edef\@@tmp{\expandafter\@secondoftwo\@@tmp}%
5272 \ifx\@@met\XC@met@step\else
5273 \edef\@@scl{\@ifxempty{#1}\colorseriescycle{#1}}%
5274 \expandafter\XC@calc@\@@tmp,,,,:D%
5275 \fi
5276 \@namexdef{\@backslashchar colorS@#2}{\@@tmp}%
5277 \endgroup}
5278 % \end{macrocode}
5279 % \end{macro}
5280 %
5281 % \begin{macro}{\XC@step}
5282 % \begin{macro}{\XC@stepabs}
5283 % \marg{name}\\
5284 % Perform a relative or absolute (= direct access) step within a color series \Meta{name}.
5285 % In the relative case, the (non-negative) number of single steps is supposed to be stored in |\@tempcnta|.
5286 % \begin{macrocode}
5287 \def\XC@step#1%
5288 {\let\xcolor@\@gobbletwo\edef\@@tmp{\@nameuse{\@backslashchar color@#1}}%
5289 \expandafter\XC@st@p\@@tmp{#1}%
5290 \@namexdef{\@backslashchar color@#1}{\noexpand\xcolor@{}{}{\@@mod}{\@@tmp}}}
5291 % \end{macrocode}
5292 %
5293 % \begin{macrocode}
5294 \def\XC@st@p#1#2#3%
5295 {\def\@@mod{#1}\def\@@tmp{#2}\edef\@@vec{\@nameuse{\@backslashchar colorS@#3}}%
5296 \@whilenum\@tempcnta>\z@\do
5297 {\XC@inflate\@@mod\@@tmp\@@vec\@@tmp
5298 \expandafter\XC@add\@@tmp,\@@tmp \expandafter\XC@calc@\@@tmp,,,,:U%
5299 \advance\@tempcnta\m@ne}}
5300 % \end{macrocode}
5301 %
5302 % \begin{macrocode}
5303 \def\XC@stepabs#1%
5304 {\edef\@@tmp{\@nameuse{\@backslashchar colorB@#1}}%
5305 \expandafter\XC@st@p\@@tmp{#1}%
5306 \edef\@@tmp
5307 {\def\noexpand\@@mod{\@@mod}\def\noexpand\@@clr{\@@tmp}}}
5308 % \end{macrocode}
5309 % \end{macro}
5310 % \end{macro}
5311 %
5312 %
5313 % \subsubsection{Color blending}
5314 %
5315 % \begin{macro}{\blendcolors}
5316 % \begin{macro}{\blendcolors*}
5317 % \marg{mix expr}\\
5318 % Initialises all necessary parameters for color blending.
5319 % The actual (completed) color blend expression is stored in |\colorblend|.
5320 % In the starred version, the argument will be appended to a previously defined blend expression.
5321 % An empty \Meta{mix expr} argument will switch blending off.
5322 % \begin{macrocode}
5323 \def\blendcolors{\@ifstar{\XC@blendcolors\colorblend}{\XC@blendcolors{}}}
5324 \def\XC@blendcolors#1#2%
5325 {\edef\colorblend{#1}\XC@edef\XC@@tmp{#2}%
5326 \ifx\XC@@tmp\@empty
5327 \xglobal@\blendcolorsfalse
5328 \else
5329 \xglobal@\blendcolorstrue
5330 \expandafter\XC@blendc@lors\XC@@tmp!!\@nil
5331 \fi
5332 \xglobalize@\colorblend \xglobal@stop}
5333 % \end{macrocode}
5334 %
5335 % \begin{macrocode}
5336 \def\XC@blendc@lors!#1!#2!#3\@nil
5337 {\@ifxempty{#1}{}%
5338 {\@ifxempty{#2}%
5339 {\edef\colorblend{\colorblend!#1!white}}%
5340 {\edef\colorblend{\colorblend!#1!#2}\XC@blendc@lors!#3!\@nil}}}
5341 % \end{macrocode}
5342 %
5343 % \begin{macrocode}
5344 \blendcolors{}
5345 % \end{macrocode}
5346 % \end{macro}
5347 % \end{macro}
5348 %
5349 %
5350 % \subsubsection{Color masks and separation}
5351 %
5352 % \begin{macro}{\maskcolors}
5353 % \oarg{core model}\marg{color}\\
5354 % Initialises all necessary parameters for color masking.
5355 % The actual color mask expression is stored in |\colormask|.
5356 % An empty \Meta{color} argument will switch masking off.
5357 % The optional \Meta{core model} argument may be used to determine the underlying color model.
5358 % \begin{macrocode}
5359 \def\maskcolors{\@testopt{\XC@maskcolors}{}}
5360 \def\XC@maskcolors[#1]#2%
5361 {\XC@edef\colormask{#2}%
5362 \ifx\colormask\@empty
5363 \xglobal@\maskcolorsfalse \def\XC@mmod{}\def\XC@mclr{}%
5364 \else
5365 \xglobal@\maskcolorstrue \extractcolorspecs\colormask\XC@mmod\XC@mclr
5366 \@ifxempty{#1}{}%
5367 {\convertcolorspec\XC@mmod\XC@mclr{#1}\XC@mclr \XC@sdef\XC@mmod{#1}}%
5368 \XC@coremodel\XC@mmod\XC@mclr
5369 \fi
5370 \xglobalize@\colormask \xglobalize@\XC@mmod \xglobalize@\XC@mclr
5371 \xglobal@stop}
5372 % \end{macrocode}
5373 %
5374 % \begin{macrocode}
5375 \maskcolors{}
5376 % \end{macrocode}
5377 % \end{macro}
5378 %
5379 %
5380 %
5381 % \subsection{Color application}
5382 %
5383 % \subsubsection{Standard color commands}
5384 %
5385 % \begin{macro}{\color}
5386 % \marg{color}\\
5387 % \oarg{model-list}\marg{spec-list}\\
5388 % Switches to the color given either by name/expression or by model/specification.
5389 % This color will stay in effect until the end of the current \TeX\ group.
5390 % \begin{macrocode}
5391 \DeclareRobustCommand\color
5392 {\@ifnextchar[\@undeclaredcolor\@declaredcolor}
5393 % \end{macrocode}
5394 % \end{macro}
5395 %
5396 % \begin{macro}{\@undeclaredcolor}
5397 % \oarg{model-list}\marg{spec-list}\\
5398 % Display a color that is given by \Meta{model} name and numerical \Meta{spec}.
5399 % \begin{macrocode}
5400 \def\@undeclaredcolor[#1]#2%
5401 {\begingroup
5402 \let\@@cls\@empty
5403 \XC@getmodclr12{#1}{#2}{}%
5404 {\ifblendcolors
5405 \ifx\colorblend\@empty\else
5406 \edef\@@mix{\expandafter\@gobble\colorblend}\@tempswafalse
5407 \XC@coremodel\@@mod\@@clr\@xcolor@{}{}\@@mod\@@clr
5408 \fi
5409 \fi
5410 \ifconvertcolorsU
5411 \edef\@@tmp{\XC@tgt@mod{\@@mod}}%
5412 \convertcolorspec\@@mod\@@clr\@@tmp\@@clr \let\@@mod\@@tmp
5413 \fi
5414 \ifmaskcolors
5415 \convertcolorspec\@@mod\@@clr\XC@mmod\@@clr
5416 \let\@@mod\XC@mmod
5417 \XC@inflate\@@mod\XC@mclr\@@clr\@@tmp
5418 \expandafter\XC@mul\@@tmp,\@@clr
5419 \fi
5420 \edef\@@tmp{\noexpand\XC@undeclaredcolor{\@@mod}{\@@clr}}%
5421 \expandafter\endgroup\@@tmp}}
5422 % \end{macrocode}
5423 %
5424 % \begin{macrocode}
5425 \def\XC@undeclaredcolor#1#2%
5426 {\@ifundefinedmodel{#1}%
5427 {\c@lor@error{model `#1'}}%
5428 {\@nameuse{color@#1}\current@color{#2}%
5429 \edef\XC@current@color{\noexpand\xcolor@{}{\current@color}{#1}{#2}}%
5430 \XC@display}}
5431 % \end{macrocode}
5432 % \end{macro}
5433 %
5434 % \begin{macro}{\@declaredcolor}
5435 % \marg{color}\\
5436 % Display a color that is given by an arbitrary \Meta{color}.
5437 % \begin{macrocode}
5438 \def\@declaredcolor#1%
5439 {\XC@edef\XC@@tmp{#1}\XC@@tstfalse
5440 \ifcase\XC@type\XC@@tmp\relax \XC@@tsttrue\or \relax\else
5441 \ifblendcolors\XC@@tsttrue\fi \ifmaskcolors\XC@@tsttrue\fi
5442 \ifconvertcolorsU\XC@@tsttrue\fi
5443 \fi
5444 \ifXC@@tst
5445 \expandafter\XC@declaredcolor\else
5446 \expandafter\XC@declaredc@lor\fi}
5447 % \end{macrocode}
5448 %
5449 % \begin{macrocode}
5450 \def\XC@declaredcolor
5451 {\XC@split\XC@@tmp
5452 \edef\@@tmp{\noexpand\@undeclaredcolor[\@@mod]{\@@clr}}%
5453 \expandafter\endgroup\@@tmp}
5454 % \end{macrocode}
5455 %
5456 % \begin{macrocode}
5457 \def\XC@declaredc@lor
5458 {\XC@let@Nc\XC@current@color{\@backslashchar color@\XC@@tmp}%
5459 \edef\current@color{\XC@current@color}%
5460 \XC@display}
5461 % \end{macrocode}
5462 % \end{macro}
5463 %
5464 % \begin{macro}{\textcolor}
5465 % \marg{color}\marg{text}\\
5466 % \oarg{model-list}\marg{spec-list}\marg{text}\\
5467 % are just alternative syntax for |\color|, in which the groups are added implicitly.
5468 % Thus \emph{text} appears in the specified color, but then the color reverts to its previous value.
5469 % The naming is by analogy with |\textrm| (as opposed to |\rm| and |\rmfamily|) although it is slightly a misnomer as the command also works in math-mode.
5470 % Additionally, it calls |\leavevmode| to ensure the start of horizontal mode.
5471 % \begin{macrocode}
5472 \protected\def\textcolor#1#{\@textcolor{#1}}
5473 \def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}}
5474 % \end{macrocode}
5475 % \end{macro}
5476 %
5477 % \begin{macro}{\pagecolor}
5478 % \marg{color}\\
5479 % \oarg{model-list}\marg{spec-list}\\
5480 % Specifies the background color for the current, and all following, pages.
5481 % It is a global declaration which does not respect \TeX\ groups.
5482 % \begin{macrocode}
5483 \protected\def\pagecolor
5484 {\begingroup
5485 \let\ignorespaces\endgroup \let\set@color\set@page@color
5486 \color}
5487 % \end{macrocode}
5488 % \end{macro}
5489 %
5490 % \begin{macro}{\nopagecolor}
5491 % Removes any currently specified page color returning to the default transparent background.
5492 % It is not yet supported by all driver options and so generates a warning if there is no definition in the driver file.
5493 % \begin{macrocode}
5494 \protected\def\nopagecolor
5495 {\@ifundefined{no@page@color}%
5496 {\PackageInfo{xcolor}{\@backslashchar nopagecolor\space is not supported}}%
5497 {\no@page@color}}
5498 % \end{macrocode}
5499 % \end{macro}
5500 %
5501 % \subsubsection{mathcolor}
5502 % We load the new mathcolor support from the kernel if it exists. The documentation
5503 % is in \texttt{mathcolor.pdf}
5504 %
5505 \InputIfFileExists{mathcolor.ltx}{}{}
5506 %
5507 % \subsubsection{Colored boxes}
5508 %
5509 % \begin{macro}{\colorbox}
5510 % \marg{color}\marg{text}\\
5511 % \oarg{model}\marg{spec}\marg{text}\\
5512 % Takes the same argument forms as |\textcolor|, but the color specifies the \emph{background} color of the box.
5513 % \begin{macrocode}
5514 \protected\def\colorbox#1#{\color@box{#1}}
5515 \def\color@box#1#2{\color@b@x\relax{\color#1{#2}}}
5516 % \end{macrocode}
5517 % \end{macro}
5518 %
5519 % \begin{macro}{\fcolorbox}
5520 % \marg{frame color}\marg{background color}\marg{text}\\
5521 % \oarg{model}\marg{frame spec}\marg{background spec}\marg{text}\\
5522 % \oarg{frame model}\marg{frame spec}\oarg{background model}\marg{background spec}\marg{text}\\
5523 % \marg{frame color}\oarg{background model}\marg{background spec}\marg{text}\\
5524 % Puts a frame of the first color around a box with a background specified by the second color.
5525 % If only the first optional argument is given, it specifies the color model for both colors.
5526 % \begin{macrocode}
5527 \protected\def\fcolorbox#1#{\color@fbox{#1}}
5528 \def\color@fbox#1#2#3#{\protect\color@fb@x{#1}{#2}{#3}}
5529 \def\color@fb@x#1#2#3#4%
5530 {\color@b@x{\fboxsep\z@\color#1{#2}\XC@fbox}%
5531 {\@ifxempty{#3}{\color#1}{\color#3}{#4}}}
5532 % \end{macrocode}
5533 % \end{macro}
5534 %
5535 % \begin{macro}{\color@b@x}
5536 % Internal macro for |\colorbox| and |\fcolorbox|.
5537 % \begin{macrocode}
5538 \long\def\color@b@x#1#2#3%
5539 {\leavevmode
5540 \setbox\z@\hbox{\kern\fboxsep{\set@color#3}\kern\fboxsep}%
5541 \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@
5542 \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@
5543 {#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}}
5544 % \end{macrocode}
5545 % \end{macro}
5546 %
5547 % \begin{macro}{\XC@frameb@x}
5548 % Common part of |\framebox| and |\fbox|.
5549 % |#1| is a negative kern in the |\framebox| case so that the vertical rules do not add to the width of the box.
5550 % Optimised by \People{Donald}{Arseneau}.
5551 % \begin{macrocode}
5552 \def\XC@frameb@x#1%
5553 {\hbox
5554 {\@tempdima\fboxrule \advance\@tempdima\fboxsep
5555 \advance\@tempdima\dp\@tempboxa
5556 \setbox\@tempboxa\hbox
5557 {\lower\@tempdima\hbox
5558 {\vbox
5559 {\kern\fboxrule
5560 \hbox{\kern\fboxrule#1%
5561 \vbox{\kern\fboxsep\box\@tempboxa\kern\fboxsep}%
5562 #1\kern\fboxrule}%
5563 \kern\fboxrule}}}%
5564 \@tempdima\wd\@tempboxa
5565 \edef\@tempa{{\the\@tempdima}{\the\ht\@tempboxa}{\the\dp\@tempboxa}}%
5566 \box\@tempboxa\kern-\@tempdima\expandafter\boxframe\@tempa}}
5567 % \end{macrocode}
5568 % \end{macro}
5569 %
5570 % \begin{macro}{\XC@fbox}
5571 % \begin{macro}{\@frameb@x}
5572 % If no \Option{kernelfbox} option was specified, switch to the new method in general, else only for |\fcolorbox|.
5573 % \begin{macrocode}
5574 \ifXC@@fbox
5575 \let\@frameb@x\XC@frameb@x \let\XC@fbox\fbox
5576 \else
5577 \def\XC@fbox{\let\@frameb@x\XC@frameb@x\fbox}
5578 \fi
5579 % \end{macrocode}
5580 % \end{macro}
5581 % \end{macro}
5582 %
5583 %
5584 % \subsubsection{Driver-specific and generic drawing}
5585 %
5586 % \begin{macro}{\color@block}
5587 % \marg{width}\marg{height}\marg{depth}\\
5588 % Should take up no space for \TeX, but produce a block in the current color of the specified size.
5589 % It is mainly used for producing box backgrounds.
5590 % \begin{macro}{\boxframe}
5591 % \marg{width}\marg{height}\marg{depth}\\
5592 % Draw a frame with a linewidth of |\fboxrule|.
5593 % Return a |\hbox| with outer dimensions \meta{width}, \meta{height}, \meta{depth}.
5594
5595 % \begin{macro}{\XC@boxframe}
5596 % \marg{width}\marg{height}\marg{depth}\marg{frame construction}\\
5597 % Wrapper for |\boxframe| commands that return zero-dimension frames.
5598 % \begin{macrocode}
5599 \ifnum\XC@@xcd@>\m@ne
5600 \def\XC@boxframe#1#2#3#4%
5601 {\hbox{\sbox\z@{\ifdim\fboxrule>\z@ #4\fi}%
5602 \wd\z@#1\relax\ht\z@#2\relax\dp\z@#3\relax\box\z@}}
5603 \fi
5604 % \end{macrocode}
5605 % \end{macro}
5606 %
5607 % \textbf{\Option{dvips}-optimised code}
5608 % \begin{macrocode}
5609 \ifcase\XC@@xcd@
5610 % \end{macrocode}
5611 %
5612 % \begin{macrocode}
5613 \providecommand*\color@block[3]%
5614 {{\set@color\hbox
5615 {\dimen@#3\edef\@tempa{ \number\dimen@\space}%
5616 \dimen@#2\edef\@tempa{ \number\dimen@\@tempa}%
5617 \dimen@#1\relax
5618 \XC@special{\number\dimen@\@tempa XCcolorblock}}}}
5619 % \end{macrocode}
5620 %
5621 % \begin{macrocode}
5622 \providecommand*\boxframe[3]%
5623 {\XC@boxframe{#1}{#2}{#3}%
5624 {\dimen@#3\edef\@tempa{ \number\dimen@\space}%
5625 \dimen@#2\edef\@tempa{ \number\dimen@\@tempa}%
5626 \dimen@#1\relax
5627 \XC@special{\number\fboxrule\space\number\dimen@\@tempa XCboxframe}}}
5628 % \end{macrocode}
5629 %
5630 % \textbf{\Option{pdftex}-optimised code }
5631 % There seems to be no improvement by adding a specific |\color@block| command, since the PDF format doesn't offer higher accuracy than \TeX.
5632 % For |\boxframe| we want to achieve this PDF pseudo-code (besides initial scaling):\\[1ex]
5633 % \centerline{\ttfamily $l$ w [] $0$ d $2$ J $0$ j $4$ M
5634 % $1$ $0$ $0$ $1$ $\frac12\,l$ $\frac12\,l$ cm
5635 % $0$ $-d$ $(w-l)$ $(h+d-l)$ re s}
5636 % \begin{macrocode}
5637 \or
5638 % \end{macrocode}
5639 %
5640 % \begin{macrocode}
5641 \providecommand*\boxframe[3]%
5642 {\XC@boxframe{#1}{#2}{#3}%
5643 {\dimen@#3\edef\@tempa{ 0 -\strip@pt\dimen@\space}%
5644 \edef\@tempb{\advance\dimen@\the\dimen@}%
5645 \dimen@#2\advance\dimen@-\fboxrule\@tempb
5646 \edef\@tempb{ \strip@pt\dimen@\space re s}%
5647 \dimen@#1\advance\dimen@-\fboxrule
5648 \edef\@tempb{ cm\@tempa\strip@pt\dimen@\@tempb}%
5649 \[email protected]\fboxrule\edef\@tempa{ \strip@pt\dimen@}%
5650 \XC@special
5651 {0.996264 0 0 0.996264 0 0 cm
5652 \strip@pt\fboxrule\space w [] 0 d 2 J 0 j 4 M
5653 1 0 0 1\@tempa\@tempa\@tempb}}}
5654 % \end{macrocode}
5655 %
5656 % \begin{macrocode}
5657 \fi
5658 % \end{macrocode}
5659 %
5660 % \textbf{Generic code }
5661 % The definition here works by selecting a color, and then drawing a \TeX\ rule (unless |\ifcolors@false|).
5662 % \begin{macrocode}
5663 \providecommand*\color@block[3]%
5664 {{\set@color\rlap{\ifcolors@\vrule\@width#1\@height#2\@depth#3\fi}}}
5665 % \end{macrocode}
5666 %
5667 % The following definition was optimised by \People{Donald}{Arseneau}.
5668 % \begin{macrocode}
5669 \providecommand*\boxframe[3]%
5670 {\hbox
5671 {\dimen@#2\advance\dimen@#3\relax
5672 \lower#3\vbox
5673 {\hrule\@height\fboxrule
5674 \@tempdima-0.5\fboxrule \ifodd\fboxrule\advance\@tempdima\m@ne sp\fi
5675 \kern\@tempdima
5676 \hbox
5677 {\advance\dimen@-\fboxrule
5678 \vrule\@width\fboxrule\@height\dimen@\@depth\z@
5679 \@tempdima#1\advance\@tempdima-\tw@\fboxrule \kern\@tempdima
5680 \vrule\@width\fboxrule\@height\dimen@\@depth\z@}%
5681 \kern-0.5\fboxrule
5682 \hrule\@height\fboxrule}}}
5683 % \end{macrocode}
5684 % \end{macro}
5685 % \end{macro}
5686 %
5687 %
5688 % \subsubsection{Color argument processing}
5689 %
5690 % \begin{macro}{\@xcolor@}
5691 % \marg{type-spec}\marg{driver-spec}\marg{model}\marg{spec}\\
5692 % This is the `work-horse' that does all necessary conversions and calculations if a color (expression) has to be displayed.
5693 % \Meta{type-spec} and \Meta{driver-spec} are ignored.
5694 % |\@@mix| may contain a mix expression without leading `!'.
5695 % \begin{macrocode}
5696 \def\@xcolor@#1#2#3#4%
5697 {\XC@sdef\@@mod{#3}\edef\@@clr{#4}%
5698 \ifx\@@mix\@empty\else\expandafter\@xcolor@@\@@mix!!!!\@nil\fi
5699 \if@tempswa
5700 \XC@let@Nc\@@tmp{XC@cnv@\@@mod @compl}%
5701 \ifx\@@tmp\relax \expandafter\XC@calc@\@@clr,,,,:C\else
5702 \expandafter\@@tmp\@@clr,\fi
5703 \let\@@clr\@@tmp
5704 \fi}
5705 % \end{macrocode}
5706 %
5707 % \begin{macrocode}
5708 \def\@xcolor@@#1!#2!#3!#4!#5\@nil
5709 {\dimen@\@ifxempty{#1}{100}{#1}\p@
5710 \edef\@@mix{\@ifxempty{#2}{white}{#2}}%
5711 \ifdim\dimen@=100\p@
5712 \expandafter\XC@postfix\@@mix]\relax
5713 \else\ifdim\dimen@=\z@
5714 \extractcolorspecs\@@mix\@@mod\@@clr
5715 \else
5716 \XC@let@Nc\@@tmp{XC@clr@\@@mod @\@@mix}%
5717 \ifx\@@tmp\relax
5718 \extractcolorspec\@@mix\@@tmp
5719 \ifx\@@mod\XC@mod@gray
5720 \edef\@@mod{\expandafter\@firstoftwo\@@tmp}%
5721 \edef\@@tmp{\expandafter\@secondoftwo\@@tmp}%
5722 \convertcolorspec\XC@mod@gray\@@clr\@@mod\@@clr
5723 \else
5724 \expandafter\convertcolorspec\@@tmp\@@mod\@@tmp
5725 \fi
5726 \else
5727 \ifx\@@mod\XC@mod@hsb\expandafter\XC@extract@hue\@@clr:\@@hue\fi
5728 \fi
5729 \XC@inflate\@@mod\@@clr\@@tmp\@@tmp
5730 \expandafter\XC@mix\@@tmp,\@@clr
5731 \fi\fi
5732 \@ifxempty{#3}%
5733 {\@ifxempty{#4}{}{\@xcolor@@!#4!#5\@nil}}%
5734 {\@xcolor@@#3!#4!#5\@nil}}
5735 % \end{macrocode}
5736 % \end{macro}
5737 %
5738 % \begin{macro}{\XC@split}
5739 % \marg{ext expr}\\
5740 % Split \Meta{ext expr} into all of its components, do the necessary calculations, and save the model of the resulting color in |\@@mod| and the parameters in |\@@clr|.
5741 % Note: |\XC@split| opens a group which has to be closed afterwards by |\endgroup|.
5742 % \begin{macrocode}
5743 \def\XC@split#1%
5744 {\begingroup\XC@edef\@@tmp{#1}\expandafter\XC@split@i\@@tmp>>\@nnil}
5745 % \end{macrocode}
5746 %
5747 % \begin{macro}{\XC@split@i}
5748 % Separate first part of expression chain and apply function(s) afterwards as requested.
5749 % \begin{macrocode}
5750 \def\XC@split@i#1>%
5751 {\def\@@tmp{#1}\XC@split@ii#1:\@nil \XC@func}
5752 % \end{macrocode}
5753 % \end{macro}
5754 %
5755 % \begin{macro}{\XC@split@ii}
5756 % Check whether it is an \emph{extended} or \emph{standard} color expression.
5757 % \begin{macrocode}
5758 \def\XC@split@ii#1:#2\@nil
5759 {\@ifxempty{#2}{\XC@split@vi}{\XC@split@iii#1,,:#2}}
5760 % \end{macrocode}
5761 % \end{macro}
5762 %
5763 % \begin{macro}{\XC@split@iii}
5764 % Initialisation for extended color expressions.
5765 % The magic \Meta{div} is either given as second argument, or calculated as the sum of all weights.
5766 % \begin{macrocode}
5767 \def\XC@split@iii#1,#2,#3:#4:%
5768 {\edef\XC@@mod{#1}\let\@tempa\@empty
5769 \ifx,#2,\XC@@tsttrue\@tempdima\z@\else\XC@@tstfalse\@tempdima#2\p@\fi
5770 \XC@split@iv#4;,;}
5771 % \end{macrocode}
5772 % \end{macro}
5773 %
5774 % \begin{macro}{\XC@split@iv}
5775 % \marg{expr}\marg{dec}\\
5776 % Step through the list of \Meta{expr},\Meta{dec} pairs.
5777 % Add \Meta{dec} to the sum of weights (in order to calculate the ultimate \Meta{div}) and append pair information to |\@tempa| command.
5778 % At the end of the list, execute |\@tempa| and map resulting parameter vector into unit cube.
5779 % Finally, |\@@mod| and |\@@clr| contain the desired information about color model and parameters.
5780 % \begin{macrocode}
5781 \def\XC@split@iv#1,#2;%
5782 {\@ifxempty{#1}%
5783 {\let\XC@@clr\@empty \@tempa \expandafter\XC@calc@\XC@@clr,,,,:U%
5784 \let\@@mod\XC@@mod \let\@@clr\@@tmp}
5785 {\XC@append\@tempa{\XC@split@v{#1}{#2}}%
5786 \ifXC@@tst\advance\@tempdima#2\p@\fi
5787 \XC@split@iv}}
5788 % \end{macrocode}
5789 % \end{macro}
5790 %
5791 % \begin{macro}{\XC@split@v}
5792 % \marg{expr}\marg{dec}\\
5793 % Extract color specification from \Meta{expr}, convert to target model, multiply the resulting vector by the quotient of \Meta{dec} and \Meta{div}, add that vector to the overall parameter vector.
5794 % \begin{macrocode}
5795 \def\XC@split@v#1#2%
5796 {\def\@@tmp{#1}\XC@split@vi
5797 \ifx\@@mod\XC@@mod\else
5798 \convertcolorspec\@@mod\@@clr\XC@@mod\@@clr
5799 \fi
5800 \dimen@#2\p@ \rdivide\dimen@\@tempdima
5801 \edef\@@scl{\strip@pt\dimen@}%
5802 \expandafter\XC@calc@\@@clr,,,,:S%
5803 \ifx\XC@@clr\@empty\let\XC@@clr\@@tmp\else
5804 \XC@inflate\XC@@mod\XC@@clr\@@tmp\@@tmp
5805 \expandafter\XC@add\@@tmp,\XC@@clr
5806 \fi}
5807 % \end{macrocode}
5808 % \end{macro}
5809 %
5810 % \begin{macro}{\XC@split@vi}
5811 % Start splitting process for standard color expression.
5812 % \begin{macrocode}
5813 \def\XC@split@vi{\count@\z@ \expandafter\XC@split@vii\@@tmp!\@nil}
5814 % \end{macrocode}
5815 % \end{macro}
5816 %
5817 % \begin{macro}{\XC@split@vii}
5818 % Count number of `-' signs at the beginning of the string.
5819 % \begin{macrocode}
5820 \def\XC@split@vii#1%
5821 {\ifx#1-\advance\count@\@ne\expandafter\XC@split@vii
5822 \else\expandafter\XC@split@viii\expandafter#1\fi}
5823 % \end{macrocode}
5824 % \end{macro}
5825 %
5826 % \begin{macro}{\XC@split@viii}
5827 % Extract \Meta{name} and \Meta{mix expr} part of color expression.
5828 % Delegate control to |\@xcolor@|.
5829 % \begin{macrocode}
5830 \def\XC@split@viii#1!#2\@nil
5831 {\edef\@@nam{#1}\edef\@@mix{#2}%
5832 \ifodd\count@\@tempswatrue\else\@tempswafalse\fi
5833 \@ifundefinedcolor\@@nam
5834 {\c@lor@error{`\@@nam'}\def\@@nam{black}}{}%
5835 \let\xcolor@\@xcolor@\@nameuse{\@backslashchar color@\@@nam}}
5836 % \end{macrocode}
5837 % \end{macro}
5838 % \end{macro}
5839 %
5840 % \begin{macro}{\XC@postfix}
5841 % Examine the postfix of a color expression and derive the actions to be taken for color series.
5842 % \begin{macrocode}
5843 \def\XC@postfix#1#2]#3\relax
5844 {\begingroup
5845 \if[#1\@tempcnta#2\relax\XC@stepabs\@@nam
5846 \else\@tempcnta\z@
5847 \@tfor\@@tok:=#1#2\do
5848 {\if+\@@tok\advance\@tempcnta\@ne
5849 \else\if-\@@tok\advance\@tempcnta\m@ne
5850 \else\@tempcnta\z@\expandafter\@break@tfor\fi\fi}%
5851 \ifnum\@tempcnta=\z@\relax\else\XC@step\@@nam\fi
5852 \let\@@tmp\@empty
5853 \fi\expandafter\endgroup\@@tmp}
5854 % \end{macrocode}
5855 % \end{macro}
5856 %
5857 % \begin{macro}{\XC@func}
5858 % \marg{function}|,{|\Meta[1]{arg}|,...,{|\Meta[n]{arg}|}>...\@nnil>|\\
5859 % General macro to handle color functions.
5860 % The number of arguments depends on the function.
5861 % Multiple consecutive functions may be applied.
5862 % Color model and specifications are input and output via |\@@mod| and |\@@clr|.
5863 % \begin{macrocode}
5864 \def\XC@func#1>{\@ifxempty{#1}{\remove@to@nnil}{\XC@fun@#1,>\XC@func}}
5865 \def\XC@fun@#1,#2>{\@nameuse{XC@func@#1}#2,,>}
5866 % \end{macrocode}
5867 % \end{macro}
5868 %
5869 % \begin{macro}{\XC@func@wheel}
5870 % \begin{macro}{\XC@func@twheel}
5871 % \marg{angle}|,|\marg{full circle}|,>|\\
5872 % Calculate color wheel position according to \Model{Hsb} or \Model{tHsb} model: \emph{hue} is rotated by \meta{angle} relative to \meta{full circle}.
5873 % The latter value is taken from |\rangeHsb| if left empty.
5874 % Finally, |\@@mod| is changed to \Model{hsb}.
5875 % \begin{macrocode}
5876 \def\XC@func@wheel#1,#2,#3>{\XC@func@wh@el{#1}{#2}0}
5877 % \end{macrocode}
5878 %
5879 % \begin{macrocode}
5880 \def\XC@func@twheel#1,#2,#3>{\XC@func@wh@el{#1}{#2}1}
5881 % \end{macrocode}
5882 %
5883 % \begin{macrocode}
5884 \def\XC@func@wh@el#1#2#3%
5885 {\convertcolorspec\@@mod\@@clr
5886 {\ifcase#3 \XC@mod@Hsb\or\XC@mod@tHsb\fi}\@@clr
5887 \expandafter\XC@extract@hue\@@clr:\@@hue \dimen@#1\p@
5888 \@ifxempty{#2}{}%
5889 {\rdivide\dimen@{#2}\lshift\dimen@
5890 \dimen@\rangeHsb\dimen@\rshift\dimen@}%
5891 \advance\dimen@\@@hue\p@ \rdivide\dimen@\rangeHsb
5892 \edef\@@hue{\strip@pt\dimen@}\XC@calcU\@@hue\@@hue
5893 \ifcase#3
5894 \expandafter\XC@replace@hue\@@clr:\@@hue,\@@clr
5895 \or
5896 \XC@c@lcS\rangeHsb{}\@@hue\@@hue
5897 \expandafter\XC@replace@hue\@@clr:\@@hue,\@@clr
5898 \convertcolorspec\XC@mod@tHsb\@@clr\XC@mod@hsb\@@clr
5899 \fi
5900 \let\@@mod\XC@mod@hsb}
5901 % \end{macrocode}
5902 % \end{macro}
5903 % \end{macro}
5904 %
5905 % \begin{macro}{\XC@display}
5906 % Write information to log file and display the current color.
5907 % \begin{macrocode}
5908 \def\XC@display
5909 {\XC@bcolor\XC@let@cN{\@backslashchar color@.}\XC@current@color
5910 \ifnum\XC@type{.}=1
5911 \PackageWarning{xcolor}{Incompatible color definition}\else
5912 \ifnum\XC@tracing>2
5913 \begingroup \let\xcolor@\@empty \def\@nil{\@backslashchar @nil}%
5914 \PackageInfo{xcolor}{Setting color `\XC@current@color'}%
5915 \endgroup
5916 \fi\fi
5917 \XC@mcolor\set@color\XC@ecolor\ignorespaces}
5918 % \end{macrocode}
5919 % \end{macro}
5920 %
5921 % \begin{macro}{\XC@bcolor}
5922 % \begin{macro}{\XC@mcolor}
5923 % \begin{macro}{\XC@ecolor}
5924 % Hooks that may be used to execute additional code within |\XC@display| immediately before/after a color is being displayed.
5925 % Note that |\XC@bcolor| can use the current color information given by |\current@color| and |\XC@current@color| if further manipulation of the color is necessary.
5926 % These hooks are intended for class/package writers and not used by \XC{} itself.
5927 % In order to prevent unwanted side effects, please make sure that all internal \XC{} variables are restored properly at the end of |\XC@display|.
5928 % \begin{macrocode}
5929 \let\XC@bcolor\relax
5930 \let\XC@mcolor\relax
5931 \let\XC@ecolor\relax
5932 % \end{macrocode}
5933 % \end{macro}
5934 % \end{macro}
5935 % \end{macro}
5936 %
5937 %
5938 % \subsubsection{Border colors for hyperlinks}
5939 %
5940 % \begin{macro}{\XC@bordercolor}
5941 % \marg{type}\marg{color}\\
5942 % Basic macro to transform \Meta{color} into the format required by \Package{hyperref}.
5943 % Here, \Meta{type} corresponds to the key `x\Meta{type}bordercolor'.
5944 % \begin{macrocode}
5945 \def\XC@bordercolor#1#2%
5946 {\extractcolorspec{#2}\XC@@tmp
5947 \expandafter\convertcolorspec\XC@@tmp\XC@mod@rgb\XC@@tmp
5948 \expandafter\edef\csname @#1bordercolor\endcsname
5949 {\expandafter\XC@strip@comma\XC@@tmp,,\@nnil}}
5950 % \end{macrocode}
5951 % \end{macro}
5952 %
5953 % \begin{macro}{\XC@pdfborder}
5954 % \Meta[1]{number}| |\Meta[2]{number}| |\Meta[3]{number}|\relax|\\
5955 % Basic macro to transform a pdfborder expression into a suitable format for \Program{dvips} with a resolution of 8000~dpi.
5956 % \begin{macrocode}
5957 \def\XC@pdfborder#1 #2 #3\relax
5958 {\def\@@scl{80}\XC@calc@#1,#2,#3,,:S%
5959 \edef\@pdfborder{\expandafter\XC@strip@comma\@@tmp,,\@nnil}}
5960 % \end{macrocode}
5961 % \end{macro}
5962 %
5963 %
5964 %
5965 %
5966 % \subsubsection{Color information}
5967 %
5968 % \begin{macro}{\extractcolorspec}
5969 % \marg{color}\marg{cmd}\\
5970 % Extracts the color specification of \Meta{color} and puts it into \Meta{cmd}; equivalent to
5971 % |\def|\Meta{cmd}|{|\marg{model}\marg{spec}|}|.
5972 % \begin{macrocode}
5973 \def\extractcolorspec#1#2%
5974 {\XC@split{#1}\edef\@@tmp{{\@@mod}{\@@clr}}\aftergroupdef#2\@@tmp}
5975 % \end{macrocode}
5976 % \end{macro}
5977 %
5978 % \begin{macro}{\extractcolorspecs}
5979 % \marg{color}\marg{model-cmd}\marg{color-cmd}\\
5980 % Extracts the color specification of \Meta{color} and puts it into \Meta{model-cmd} and \Meta{color-cmd}, respectively.
5981 % \begin{macrocode}
5982 \def\extractcolorspecs#1#2#3%
5983 {\extractcolorspec{#1}#3%
5984 \edef#2{\expandafter\@firstoftwo#3}%
5985 \edef#3{\expandafter\@secondoftwo#3}}
5986 % \end{macrocode}
5987 % \end{macro}
5988 %
5989 % \begin{macro}{\XC@extract@hue}
5990 % Extract first entry of comma-separated value list.
5991 % \begin{macrocode}
5992 \def\XC@extract@hue#1,#2:#3{\edef#3{#1}}
5993 % \end{macrocode}
5994 % \end{macro}
5995 %
5996 % \begin{macro}{\XC@extract@hue}
5997 % Change first entry of comma-separated value list.
5998 % \begin{macrocode}
5999 \def\XC@replace@hue#1,#2:#3,#4{\edef#4{#3,#2}}
6000 % \end{macrocode}
6001 % \end{macro}
6002 %
6003 % \begin{macro}{\@ifundefinedcolor}
6004 % \marg{name}\marg{undefined}\marg{defined}\\
6005 % Checks whether \Meta{name} is a defined color name and executes the respective code.
6006 % \begin{macrocode}
6007 \def\@ifundefinedcolor#1{\@ifundefined{\@backslashchar color@#1}}
6008 % \end{macrocode}
6009 % \end{macro}
6010 %
6011 % \begin{macro}{\@ifundefinedmodel}
6012 % \marg{model}\marg{undefined}\marg{defined}\\
6013 % Checks whether \Meta{model} is a defined color model and executes the respective code.
6014 % \begin{macrocode}
6015 \def\@ifundefinedmodel#1{\@ifundefined{color@#1}}
6016 % \end{macrocode}
6017 % \end{macro}
6018 %
6019 % \begin{macro}{\XC@type}
6020 % \marg{name}\\
6021 % Determines the \emph{type} of color \Meta{name}, expressed as a natural number (here, $t_1,t_2,\dots$ denote the tokens of |\\color@|\Meta{name}):
6022 % \begin{center}
6023 % \begin{tabular}{cll}
6024 % \em type& \em description& \em conditions\\
6025 % 0 & undefined\\
6026 % 1 & unidentified& $t_1\neq|\xcolor@|$\\
6027 % 2 & named & $t_1=|\xcolor@|\quad t_2\neq\emptyset$\\
6028 % 3 & declared & $t_1=|\xcolor@|\quad t_2=\emptyset\quad t_3\neq\emptyset$\\
6029 % 4 & undeclared & $t_1=|\xcolor@|\quad t_2=\emptyset\quad t_3=\emptyset$\\
6030 % \end{tabular}
6031 % \end{center}
6032 % \begin{macrocode}
6033 \def\XC@type#1%
6034 {\expandafter\expandafter\expandafter\XC@typ@
6035 \csname\@backslashchar color@#1\endcsname\@empty\@empty\@empty\XC@@}
6036 % \end{macrocode}
6037 %
6038 % \begin{macrocode}
6039 \def\XC@typ@#1#2#3#4\XC@@
6040 {\ifx#1\relax 0\else
6041 \ifx#1\xcolor@
6042 \ifx$#2$%
6043 \ifx$#3$4\else3\fi\@gobbletwo
6044 \else2\fi\@gobbletwo
6045 \else1\fi
6046 \fi}
6047 % \end{macrocode}
6048 % \end{macro}
6049 %
6050 % \begin{macro}{\XC@info}
6051 % \marg{color}\marg{cmd}\\
6052 % Determines the \emph{type} of color \Meta{color}, expressed as a natural number; the result is stored in \Meta{cmd}.
6053 % \begin{center}
6054 % \begin{tabular}{cll}
6055 % \em type& \em description& \em examples\\
6056 % 0 & implicit name& `|.|'\\
6057 % 1 & explicit name& `|red|', `|green|'\\
6058 % 2 & standard color expression& `|-red|', `|green!50|'\\
6059 % 3 & extended color expression& `|rgb:-red,1;green!50,2|'\\
6060 % 4 & color function expression& `|rgb:-red,1;green!50,2>wheel,30|'\\
6061 % \end{tabular}
6062 % \end{center}
6063 % \begin{macrocode}
6064 \def\XC@info#1#2%
6065 {\XC@edef#2{#1}%
6066 \expandafter\in@\expandafter>\expandafter{#2}%
6067 \ifin@\def#2{4}\else\expandafter\in@\expandafter:\expandafter{#2}%
6068 \ifin@\def#2{3}\else\expandafter\in@\expandafter!\expandafter{#2}%
6069 \ifin@\def#2{2}\else % now there's no >,:,!
6070 \if-\expandafter\@car#2\relax\@nil\def#2{2}\else % catches -red
6071 \edef#2{\noexpand\in@{/./}{/#2/}}#2%
6072 \edef#2{\ifin@0\else1\fi}\fi\fi\fi\fi}
6073 % \end{macrocode}
6074 % \end{macro}
6075 %
6076 % \begin{macro}{\tracingcolors}
6077 % Put the integer following |\tracingcolors| into the macro |\XC@tracing|.
6078 % \begin{macrocode}
6079 \def\tracingcolors{\begingroup\afterassignment\XC@tracingcolors\count@}
6080 \def\XC@tracingcolors{\aftergroupdef\XC@tracing{\the\count@}}
6081 % \end{macrocode}
6082 %
6083 % \begin{macrocode}
6084 \tracingcolors=0
6085 % \end{macrocode}
6086 % \end{macro}
6087 %
6088 % \begin{macro}{\XC@logdef}
6089 % \marg{name}\\
6090 % Issue a log file information if color \Meta{name} is being (re)defined.
6091 % \begin{macrocode}
6092 \def\XC@logdef#1%
6093 {\ifnum\XC@tracing>1
6094 \@ifundefinedcolor{#1}%
6095 {\ifnum\XC@tracing>2
6096 \PackageInfo{xcolor}{Defining color `#1'}%
6097 \fi}%
6098 {\PackageInfo{xcolor}{Redefining color `#1'}}%
6099 \fi}
6100 % \end{macrocode}
6101 % \end{macro}
6102 %
6103 %
6104 % \subsubsection{Color testing}
6105 %
6106 % \begin{environment}{testcolors}
6107 % \oarg{num models}\\
6108 % This is a simple tabular environment in order to test (display) colors in different models, showing both the visual result and the model-specific parameters.
6109 % The optional \Meta{num models} argument is a comma-separated list of \emph{numerical} color models.
6110 % \begin{macrocode}
6111 \newenvironment*{testcolors}[1][rgb,cmyk,hsb,HTML]%
6112 {\let\@@nam\@empty\count@\z@
6113 \@for\@@tmp:=#1\do
6114 {\advance\count@\@ne
6115 \XC@sdef\@@tmp{\@@tmp}\edef\@@nam{\@@nam{\@@tmp}}}%
6116 \edef\@@num{\the\count@}%
6117 % \end{macrocode}
6118 %
6119 % Check whether the actual font belongs to a set of OT1-encoded monospaced fonts in order to display |>| instead of |\textgreater|.
6120 % \begin{macro}{\XC@@gt}
6121 % \begin{macrocode}
6122 \def\XC@@gt{\textgreater}\def\@@tmp{OT1}%
6123 \ifx\f@encoding\@@tmp
6124 \@expandtwoargs\in@{,\f@family,}{,cmtt,pcr,}%
6125 \ifin@\def\XC@@gt{>}\fi
6126 \fi
6127 % \end{macrocode}
6128 % \end{macro}
6129 %
6130 % Disable prologue and tracing commands for temporary color definitions.
6131 % \begin{macrocode}
6132 \def\XC@@xcp@{-1}\ifnum\XC@tracing>1 \def\XC@tracing{1}\fi
6133 % \end{macrocode}
6134 %
6135 % \begin{macro}{\testcolor}
6136 % \marg{color}\\
6137 % \oarg{model-list}\marg{spec-list}\\
6138 % Each |\testcolor| command generates a table row.
6139 % If the column-model matches the model of the color in question, its parameters are underlined.
6140 % \begin{macrocode}
6141 \def\testcolor{\@testopt{\@testcolor}{}}%
6142 \def\@testcolor[##1]##2%
6143 {\XC@mdef\@@mod{##1}\XC@edef\@@clr{##2}%
6144 \ifx\@@mod\@empty
6145 \let\@@arg\@@clr\XC@replace\@@arg>\XC@@gt\else
6146 \edef\@@arg{[\@@mod]{\@@clr}}\XC@definecolor[]{*}\@@mod\@@clr
6147 \def\@@clr{*}\fi
6148 \XC@append\@@arg{&}\extractcolorspecs\@@clr\@@mod\@@clr
6149 \@testc@lor}%
6150 % \end{macrocode}
6151 % \end{macro}
6152 %
6153 % Common loop macro for table head and |\testcolor| rows.
6154 % Note that this command is only available within the |testcolors| environment.
6155 % \begin{macrocode}
6156 \def\@testc@lor
6157 {\count@\z@
6158 \expandafter\@tfor\expandafter\@@tmp\expandafter:\expandafter=\@@nam\do
6159 {\ifx\@@clr\@empty
6160 \edef\@@cmd{\noexpand\textbf{\@@tmp}}%
6161 \else
6162 \convertcolorspec\@@mod\@@clr\@@tmp\@@cmd
6163 \edef\@@cmd
6164 {\noexpand\@testc@l@r{\@@tmp}{\@@cmd}%
6165 \ifx\@@mod\@@tmp\noexpand\underline\fi
6166 {\expandafter\XC@strip@comma\@@cmd,,\@nnil}}%
6167 \fi
6168 \expandafter\XC@append\expandafter\@@arg\expandafter{\@@cmd}%
6169 \advance\count@\@ne
6170 \ifnum\count@=\@@num\XC@append\@@arg{\\}\else\XC@append\@@arg{&}\fi}%
6171 \@@arg}%
6172 % \end{macrocode}
6173 %
6174 % Display color sample box:
6175 % \begin{macrocode}
6176 \def\@testc@l@r##1##2%
6177 {\fboxsep\z@\fbox{\colorbox[##1]{##2}{\phantom{XX}}} }%
6178 % \end{macrocode}
6179 %
6180 % Now start the table:
6181 % \begin{macrocode}
6182 \tabular{@{}l*{\@@num}{l}@{}}%
6183 \def\@@arg{\textbf{color}& }\let\@@clr\@empty\@testc@lor}%
6184 % \end{macrocode}
6185 %
6186 % End of environment:
6187 % \begin{macrocode}
6188 {\endtabular\ignorespacesafterend}
6189 % \end{macrocode}
6190 % \end{environment}
6191 %
6192 %
6193 % \subsubsection{Extra groups}
6194 %
6195 % Like |\normalcolor|, the following five commands are defined in the kernel.
6196 % This means that they can be used to make macros in packages `color safe'.
6197 % The extra groups have been made permanent in the \LaTeX{} kernel 2021 so
6198 % they are no longer redefined here.
6199 % The |\color@setgroup| will not have any effect unless a user also uses
6200 % a color package, when the `active definition' here will take effect.
6201 %
6202 % \begin{macro}{\color@setgroup}
6203 % This is to be used in contexts (e.g., `lrbox') where text is to be saved and used after some other, unknown, text that may contain color commands.
6204 % A matching |\color@endgroup| should be used at the end of the text.
6205 % \begin{macrocode}
6206 \def\color@setgroup{\begingroup\set@color}
6207 % \end{macrocode}
6208 % \end{macro}
6209 %
6210 % \begin{macro}{\color@begingroup}
6211 % This is to be used at the start of contexts that may contain color commands, but where it is not necessary to save the current color.
6212 % Examples of this are in the box commands of \File{ltboxes.dtx} where user-supplied text is saved internally in a box between |\color@begingroup|, |\color@endgroup|, but the box is used before any other color commands could intervene.
6213 % A matching |\color@endgroup| should be used at the end of the text.
6214 % \end{macro}
6215 %
6216 % \begin{macro}{\color@endgroup}
6217 % To be used to close the `group' started by one of the above two commands.
6218 % The |\endgraf| in its definition is required in the case of groups of text in vertical `par' mode, but doesn't do any harm in horizontal `LR' contexts.
6219 % \end{macro}
6220 %
6221 % \begin{macro}{\color@hbox}
6222 % To be used to open a `colored hbox'
6223 % \end{macro}
6224 %
6225 % \begin{macro}{\color@vbox}
6226 % To be used to open a `colored hbox'
6227 % \end{macro}
6228 %
6229 % \begin{macro}{\color@endbox}
6230 % To be used to close a `colored (h/v)box'
6231 % \end{macro}
6232 %
6233 %
6234 %
6235 % \subsection{Color calculation}
6236 %
6237 % \subsubsection{Color conversion}
6238 %
6239 % \begin{macro}{\convertcolorspec}
6240 % \marg{source model}\marg{spec}\marg{target model}\marg{cmd}\\
6241 % General color conversion command.
6242 % \begin{macrocode}
6243 \def\convertcolorspec#1#2#3#4%
6244 {\begingroup
6245 \XC@sdef\sm{#1}\XC@sdef\tm{#3}\edef\@@tmp{#2}%
6246 \ifx\sm\XC@mod@named\extractcolorspecs\@@tmp\sm\@@tmp\fi
6247 \ifx\sm\tm\else\csname XC@cnv@\sm\expandafter\endcsname\@@tmp,\fi
6248 \aftergroupdef#4\@@tmp}
6249 % \end{macrocode}
6250 % \end{macro}
6251 %
6252 % \begin{macro}{\XC@coremodel}
6253 % \marg{model-cmd}\marg{color-cmd}\\
6254 % Convert color, given by \marg{model-cmd} and \marg{color-cmd}, into parametrisation in one of the \emph{core} models.
6255 % The result is again saved in \marg{model-cmd} and \marg{color-cmd}.
6256 % \begin{macrocode}
6257 \def\XC@coremodel#1#2%
6258 {\XC@ifxcase#1%
6259 {\XC@mod@RGB {\convertcolorspec#1#2\XC@mod@rgb#2\let#1\XC@mod@rgb}%
6260 \XC@mod@HTML{\convertcolorspec#1#2\XC@mod@rgb#2\let#1\XC@mod@rgb}%
6261 \XC@mod@Hsb {\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
6262 \XC@mod@tHsb{\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
6263 \XC@mod@HSB {\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
6264 \XC@mod@Gray{\convertcolorspec#1#2\XC@mod@gray#2\let#1\XC@mod@gray}%
6265 \XC@mod@wave{\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
6266 \XC@mod@named{}%
6267 \XC@mod@ps{}}%
6268 {\expandafter\XC@calc@#2,,,,:N\let#2\@@tmp}}
6269 % \end{macrocode}
6270 % \end{macro}
6271 %
6272 % \begin{macro}{\XC@cnv@rgb}
6273 % \Meta{red}|,|\Meta{green}|,|\Meta{blue}|,|
6274 % \begin{macrocode}
6275 \def\XC@cnv@rgb#1,#2,#3,%
6276 {\XC@ifxcase\tm
6277 {\XC@mod@cmy {\XC@calc@#1,#2,#3,,:C}%
6278 \XC@mod@cmyk
6279 {\XC@calc@#1,#2,#3,,:C\expandafter\XC@cnv@cmy@cmyk\@@tmp,}%
6280 \XC@mod@RGB {\edef\@@scl{\rangeRGB}\XC@calc@#1,#2,#3,,:M}%
6281 \XC@mod@HTML{\edef\@@scl{\@cclv}\XC@calc@#1,#2,#3,,:M%
6282 \expandafter\XC@calc@\@@tmp,,:H%
6283 \expandafter\XC@cnv@rgb@HTML\@@tmp,}%
6284 \XC@mod@gray{\XC@cnv@rgb@gray#1,#2,#3,}%
6285 \XC@mod@Gray{\XC@cnv@rgb@gray#1,#2,#3,\XC@cnv@gray\@@tmp,}}%
6286 {\XC@cnv@rgb@hsb#1,#2,#3,\XC@cnv@hsb@}}
6287 % \end{macrocode}
6288 %
6289 % \begin{macro}{\XC@cnv@rgb@}
6290 % \begin{macrocode}
6291 \def\XC@cnv@rgb@
6292 {\ifx\tm\XC@mod@rgb\else\expandafter\XC@cnv@rgb\@@tmp,\fi}
6293 % \end{macrocode}
6294 % \end{macro}
6295 % \end{macro}
6296 %
6297 % \begin{macro}{\XC@cnv@rgb@hsb}
6298 % \Meta{red}|,|\Meta{green}|,|\Meta{blue}|,|
6299 % \begin{macrocode}
6300 \def\XC@cnv@rgb@hsb#1,#2,#3,%
6301 {\count@\z@
6302 \ifdim#2\p@>#1\p@ \else\advance\count@4 \fi
6303 \ifdim#3\p@>#2\p@ \else\advance\count@2 \fi
6304 \ifdim#1\p@>#3\p@ \else\advance\count@1 \fi
6305 \ifcase\count@\or
6306 \XC@c@v@rgb@hsb{#3}{#2}{#1}3{}\or
6307 \XC@c@v@rgb@hsb{#2}{#1}{#3}1{}\or
6308 \XC@c@v@rgb@hsb{#2}{#3}{#1}3-\or
6309 \XC@c@v@rgb@hsb{#1}{#3}{#2}5{}\or
6310 \XC@c@v@rgb@hsb{#3}{#1}{#2}5-\or
6311 \XC@c@v@rgb@hsb{#1}{#2}{#3}1-\or
6312 \def\@tempa{0}\def\@tempb{0}\XC@calcN{#3}\@tempc
6313 \fi
6314 \edef\@@tmp{\@tempa,\@tempb,\@tempc}}
6315 % \end{macrocode}
6316 % \end{macro}
6317 %
6318 % \begin{macro}{\XC@c@v@rgb@hsb}
6319 % \marg{max}\marg{med}\marg{min}\marg{const}\marg{sign}
6320 % \begin{macrocode}
6321 \def\XC@c@v@rgb@hsb#1#2#3#4#5%
6322 {\XC@calcN{#1}\@tempc \llshiftset\dimen@{#1}%
6323 \llshiftset\@tempdimb{-#3}\advance\@tempdimb\dimen@
6324 \llshiftset\@tempdima{-#5#2}\advance\@tempdima#5\dimen@
6325 \advance\@tempdima#4\@tempdimb \rdivide\@tempdima{6\@tempdimb}%
6326 \edef\@tempa{\ifdim\@tempdima>\p@1\else\strip@pt\@tempdima\fi}%
6327 \rdivide\@tempdimb\dimen@
6328 \edef\@tempb{\strip@pt\@tempdimb}}
6329 % \end{macrocode}
6330 % \end{macro}
6331 %
6332 % \begin{macro}{\XC@cnv@rgb@gray}
6333 % \Meta{red}|,|\Meta{green}|,|\Meta{blue}|,|
6334 % \begin{macrocode}
6335 \def\XC@cnv@rgb@gray#1,#2,#3,%
6336 {\llshiftset\dimen@{#1}\@tempdima30\dimen@
6337 \llshiftset\dimen@{#2}\advance\@tempdima59\dimen@
6338 \llshiftset\dimen@{#3}\advance\@tempdima11\dimen@
6339 \rrshift\@tempdima \rdivide\@tempdima{100}%
6340 \edef\@@tmp{\strip@pt\@tempdima}}
6341 % \end{macrocode}
6342 % \end{macro}
6343 %
6344 % \begin{macro}{\XC@cnv@rgb@HTML}
6345 % \Meta{red}|,|\Meta{green}|,|\Meta{blue}|,|
6346 % \begin{macrocode}
6347 \def\XC@cnv@rgb@HTML#1,#2,#3,%
6348 {\edef\@@tmp{#1#2#3}}
6349 % \end{macrocode}
6350 % \end{macro}
6351 %
6352 %
6353 % \begin{macro}{\XC@cnv@cmy}
6354 % \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|
6355 % \begin{macrocode}
6356 \def\XC@cnv@cmy#1,#2,#3,%
6357 {\XC@ifxcase\tm
6358 {\XC@mod@cmyk{\XC@cnv@cmy@cmyk#1,#2,#3,}%
6359 \XC@mod@gray{\XC@cnv@rgb@gray#1,#2,#3,\XC@calcC\@@tmp\@@tmp}%
6360 \XC@mod@Gray{\XC@cnv@rgb@gray#1,#2,#3,\XC@calcC\@@tmp\@@tmp
6361 \XC@cnv@gray\@@tmp,}}%
6362 {\XC@calc@#1,#2,#3,,:C\XC@cnv@rgb@}}
6363 % \end{macrocode}
6364 % \end{macro}
6365 %
6366 % \begin{macro}{\XC@cnv@cmy@cmyk}
6367 % \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|\\
6368 % This transformation includes linear \emph{undercolor-removal} and \emph{black-generation}, as specified by the 4-dimensional parameter vector |\adjustUCRBG|.
6369 % \begin{macrocode}
6370 \def\XC@cnv@cmy@cmyk#1,#2,#3,%
6371 {\edef\@@scl
6372 {\ifdim#1\p@<#2\p@
6373 \ifdim#1\p@<#3\p@ #1\else #3\fi \else
6374 \ifdim#2\p@<#3\p@ #2\else #3\fi \fi}%
6375 \expandafter\XC@calc@\adjustUCRBG,:S%
6376 \expandafter\XC@c@v@cmy@cmyk\@@tmp,#1,#2,#3,}
6377 % \end{macrocode}
6378 %
6379 % \begin{macrocode}
6380 \def\XC@c@v@cmy@cmyk#1,#2,#3,#4,#5,#6,#7,%
6381 {\XC@add#5,#6,#7,,-#1,-#2,-#3,,\@@tmp \edef\@@tmp{\@@tmp,#4}%
6382 \expandafter\XC@calc@\@@tmp,:N}
6383 % \end{macrocode}
6384 % \end{macro}
6385 %
6386 %
6387 % \begin{macro}{\XC@cnv@cmyk}
6388 % \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|\Meta{black}|,|
6389 % \begin{macrocode}
6390 \def\XC@cnv@cmyk#1,#2,#3,#4,%
6391 {\XC@ifxcase\tm
6392 {\XC@mod@gray{\XC@cnv@rgb@gray#1,#2,#3,\edef\@@arg{#4}%
6393 \XC@calcT\@@tmp\@@tmp \XC@calcC\@@tmp\@@tmp}%
6394 \XC@mod@Gray{\XC@cnv@rgb@gray#1,#2,#3,\edef\@@arg{#4}%
6395 \XC@calcT\@@tmp\@@tmp \XC@calcC\@@tmp\@@tmp \XC@cnv@gray\@@tmp,}}%
6396 {\XC@cnv@cmyk@cmy#1,#2,#3,#4,%
6397 \ifx\tm\XC@mod@cmy\else\expandafter\XC@cnv@cmy\@@tmp,\fi}}
6398 % \end{macrocode}
6399 % \end{macro}
6400 %
6401 % \begin{macro}{\XC@cnv@cmyk@cmy}
6402 % \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|\Meta{black}|,|
6403 % \begin{macrocode}
6404 \def\XC@cnv@cmyk@cmy#1,#2,#3,#4,%
6405 {\edef\@@arg{#4}\XC@calc@#1,#2,#3,,:T}
6406 % \end{macrocode}
6407 % \end{macro}
6408 %
6409 %
6410 % \begin{macro}{\XC@cnv@hsb}
6411 % \Meta{hue}|,|\Meta{saturation}|,|\Meta{brightness}|,|
6412 % \begin{macrocode}
6413 \def\XC@cnv@hsb#1,#2,#3,%
6414 {\XC@ifxcase\tm
6415 {\XC@mod@Hsb {\XC@cnv@hsb@Hsb#1,#2,#3,}%
6416 \XC@mod@tHsb{\XC@cnv@hsb@Hsb#1,#2,#3,\expandafter\XC@cnv@Hsb\@@tmp,}%
6417 \XC@mod@HSB {\edef\@@scl{\rangeHSB}\XC@calc@#1,#2,#3,,:M}}%
6418 {\XC@cnv@hsb@rgb#1,#2,#3,\XC@cnv@rgb@}}
6419 % \end{macrocode}
6420 %
6421 % \begin{macro}{\XC@cnv@hsb@}
6422 % \begin{macrocode}
6423 \def\XC@cnv@hsb@
6424 {\ifx\tm\XC@mod@hsb\else\expandafter\XC@cnv@hsb\@@tmp,\fi}
6425 % \end{macrocode}
6426 % \end{macro}
6427 % \end{macro}
6428 %
6429 % \begin{macro}{\XC@cnv@hsb@rgb}
6430 % \Meta{hue}|,|\Meta{saturation}|,|\Meta{brightness}|,|
6431 % \begin{macrocode}
6432 \def\XC@cnv@hsb@rgb#1,#2,#3,%
6433 {\llshiftset\dimen@{#1}\dimen@6\dimen@ \rrshift\dimen@
6434 \afterassignment\dimen@\count@=\the\dimen@
6435 \edef\@@tmp{\strip@pt\dimen@}%
6436 \ifodd\count@\else\XC@calcC\@@tmp\@@tmp\fi
6437 \edef\@@tmp
6438 {\ifcase\count@ 0,\@@tmp,1\or \@@tmp,0,1\or 1,0,\@@tmp\or
6439 1,\@@tmp,0\or \@@tmp,1,0\or 0,1,\@@tmp\or 0,\@@tmp,1\fi}%
6440 \edef\@@scl{#2}\expandafter\XC@calc@\@@tmp,,:S%
6441 \expandafter\XC@calc@\@@tmp,,:C%
6442 \edef\@@scl{#3}\expandafter\XC@calc@\@@tmp,,:S%
6443 \expandafter\XC@calc@\@@tmp,,:N}
6444 % \end{macrocode}
6445 % \end{macro}
6446 %
6447 % \begin{macro}{\XC@cnv@hsb@Hsb}
6448 % \Meta{hue}|,|\Meta{saturation}|,|\Meta{brightness}|,|
6449 % \begin{macrocode}
6450 \def\XC@cnv@hsb@Hsb#1,#2,#3,%
6451 {\XC@c@lcS\rangeHsb{,#2,#3}{#1}\@@tmp}
6452 % \end{macrocode}
6453 % \end{macro}
6454 %
6455 % \begin{macro}{\XC@cnv@gray}
6456 % \Meta{gray}|,|
6457 % \changes{3.0}{2022-08-10}{moved the patch from hycolor to correct Gray model, issue \#23}w
6458 % \begin{macrocode}
6459 \def\XC@cnv@gray#1,%
6460 {\XC@ifxcase\tm
6461 {\XC@mod@rgb {\XC@calcN{#1}\@@tmp \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}}%
6462 \XC@mod@gray{}%
6463 \XC@mod@cmy {\XC@calcC{#1}\@@tmp \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}}%
6464 \XC@mod@cmyk{\XC@calcC{#1}\@@tmp \edef\@@tmp{0,0,0,\@@tmp}}%
6465 \XC@mod@RGB {\edef\@@scl{\rangeRGB}\XC@calcM{#1}\@@tmp
6466 \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}}%
6467 \XC@mod@HTML{\edef\@@scl{\@cclv}\XC@calcM{#1}\@@tmp
6468 \XC@calcH\@@tmp\@@tmp \edef\@@tmp{\@@tmp\@@tmp\@@tmp}}%
6469 \XC@mod@HSB {\edef\@@scl{\rangeHSB}\XC@calcM{#1}\@@tmp
6470 \edef\@@tmp{0,0,\@@tmp}}%
6471 \XC@mod@Gray{\edef\@@scl{\rangeGray}\XC@calcM{#1}\@@tmp}}%
6472 {\XC@calcN{#1}\@@tmp \edef\@@tmp{0,0,\@@tmp}}}
6473 % \end{macrocode}
6474 % \end{macro}
6475 %
6476 %
6477 % \begin{macro}{\XC@cnv@RGB}
6478 % \Meta{Red}|,|\Meta{Green}|,|\Meta{Blue}|,|
6479 % \begin{macrocode}
6480 \def\XC@cnv@RGB#1,#2,#3,%
6481 {\edef\@@scl{\rangeRGB}\XC@calc@#1,#2,#3,,:D\XC@cnv@rgb@}
6482 % \end{macrocode}
6483 % \end{macro}
6484 %
6485 %
6486 % \begin{macro}{\XC@cnv@HTML}
6487 % \Meta{RRGGBB}|,|
6488 % \begin{macrocode}
6489 \def\XC@cnv@HTML#1,%
6490 {\edef\@@tmp{\expandafter\@hex@Hex#1\relax}\expandafter\XC@cnv@HTML@\@@tmp
6491 \edef\@@scl{\@cclv}\expandafter\XC@calc@\@@tmp,,:D\XC@cnv@rgb@}
6492 % \end{macrocode}
6493 %
6494 % \begin{macrocode}
6495 \def\XC@cnv@HTML@#1#2#3#4#5#6%
6496 {\edef\@@tmp{\number"#1#2,\number"#3#4,\number"#5#6}}
6497 % \end{macrocode}
6498 % \end{macro}
6499 %
6500 %
6501 % \begin{macro}{\XC@cnv@Hsb}
6502 % \Meta{hue\Circ}|,|\Meta{saturation}|,|\Meta{brightness}|,|
6503 % \begin{macrocode}
6504 \def\XC@cnv@Hsb#1,#2,#3,%
6505 {\ifx\tm\XC@mod@tHsb\XC@cnv@@Hsb#1,#2,#3,\XC@cnv@Hsb@
6506 \else\XC@cnv@Hsb@hsb#1,#2,#3,\XC@cnv@hsb@\fi}
6507 % \end{macrocode}
6508 % \end{macro}
6509 %
6510 % \begin{macro}{\XC@cnv@Hsb@hsb}
6511 % \Meta{hue\Circ}|,|\Meta{saturation}|,|\Meta{brightness}|,|
6512 % \begin{macrocode}
6513 \def\XC@cnv@Hsb@hsb#1,#2,#3,%
6514 {\XC@c@lcD\rangeHsb{,#2,#3}{#1}\@@tmp}
6515 % \end{macrocode}
6516 % \end{macro}
6517 %
6518 % \begin{macro}{\XC@cnv@@Hsb}
6519 % \Meta{hue\Circ}|,|\Meta{saturation}|,|\Meta{brightness}|,|\marg{cmd}
6520 % \begin{macrocode}
6521 \def\XC@cnv@@Hsb#1,#2,#3,#4%
6522 {\dimen@\rangeHsb\p@ \advance\dimen@\p@ \edef\@@tmp{\strip@pt\dimen@}%
6523 \edef\@@tmp{0,0;\rangetHsb;\rangeHsb,\rangeHsb;\@@tmp,\@@tmp;}%
6524 \dimen@#1\p@ \expandafter#4\@@tmp\@nnil
6525 \edef\@@tmp{\strip@pt\dimen@,#2,#3}}
6526 % \end{macrocode}
6527 % \end{macro}
6528 %
6529 % \begin{macro}{\XC@cnv@Hsb@}
6530 % \Meta{x}|,|\Meta{y}|;|\Meta{x'}|,|\Meta{y'}|;|
6531 % \begin{macrocode}
6532 \def\XC@cnv@Hsb@#1,#2;#3,#4;%
6533 {\ifdim\dimen@<#4\p@
6534 \@tempdima#3\p@ \advance\@tempdima-#1\p@
6535 \@tempdimb#4\p@ \advance\@tempdimb-#2\p@
6536 \rdivide\@tempdima\@tempdimb
6537 \advance\dimen@-#2\p@ \rmultiply\dimen@{\strip@pt\@tempdima}%
6538 \advance\dimen@#1\p@ \expandafter\remove@to@nnil
6539 \else
6540 \def\@@tmp{\XC@cnv@Hsb@#3,#4;}\expandafter\@@tmp
6541 \fi}
6542 % \end{macrocode}
6543 % \end{macro}
6544 %
6545 %
6546 % \begin{macro}{\XC@cnv@tHsb}
6547 % \Meta{hue\Circ}|,|\Meta{saturation}|,|\Meta{brightness}|,|
6548 % \begin{macrocode}
6549 \def\XC@cnv@tHsb#1,#2,#3,%
6550 {\XC@cnv@@Hsb#1,#2,#3,\XC@cnv@tHsb@
6551 \ifx\tm\XC@mod@Hsb\else\expandafter\XC@cnv@Hsb\@@tmp,\fi}
6552 % \end{macrocode}
6553 % \end{macro}
6554 %
6555 % \begin{macro}{\XC@cnv@tHsb@}
6556 % \Meta{x}|,|\Meta{y}|;|\Meta{x'}|,|\Meta{y'}|;|
6557 % \begin{macrocode}
6558 \def\XC@cnv@tHsb@#1,#2;#3,#4;%
6559 {\ifdim\dimen@<#3\p@
6560 \@tempdima#4\p@ \advance\@tempdima-#2\p@
6561 \@tempdimb#3\p@ \advance\@tempdimb-#1\p@
6562 \rdivide\@tempdima\@tempdimb
6563 \advance\dimen@-#1\p@ \rmultiply\dimen@{\strip@pt\@tempdima}%
6564 \advance\dimen@#2\p@ \expandafter\remove@to@nnil
6565 \else
6566 \def\@@tmp{\XC@cnv@tHsb@#3,#4;}\expandafter\@@tmp
6567 \fi}
6568 % \end{macrocode}
6569 % \end{macro}
6570 %
6571 %
6572 % \begin{macro}{\XC@cnv@HSB}
6573 % \Meta{Hue}|,|\Meta{Saturation}|,|\Meta{Brightness}|,|
6574 % \begin{macrocode}
6575 \def\XC@cnv@HSB#1,#2,#3,%
6576 {\edef\@@scl{\rangeHSB}\XC@calc@#1,#2,#3,,:D\XC@cnv@hsb@}
6577 % \end{macrocode}
6578 % \end{macro}
6579 %
6580 %
6581 % \begin{macro}{\XC@cnv@Gray}
6582 % \Meta{Gray}|,|
6583 % \begin{macrocode}
6584 \def\XC@cnv@Gray#1,%
6585 {\XC@c@lcD\rangeGray{}{#1}\@@tmp \XC@cnv@gray\@@tmp,}
6586 % \end{macrocode}
6587 % \end{macro}
6588 %
6589 %
6590 % \begin{macro}{\XC@cnv@wave}
6591 % \Meta{lambda}|,|
6592 % \begin{macrocode}
6593 \def\XC@cnv@wave#1,%
6594 {\XC@cnv@wave@hsb#1,\XC@cnv@hsb@}
6595 % \end{macrocode}
6596 % \end{macro}
6597 %
6598 % \begin{macro}{\XC@cnv@wave@hsb}
6599 % \Meta{lambda}|,|
6600 % \begin{macrocode}
6601 \def\XC@cnv@wave@hsb#1,%
6602 {\@tempdima#1\p@
6603 % \end{macrocode}
6604 %
6605 % Calculate hue:
6606 % \begin{macrocode}
6607 \ifdim\@tempdima<440\p@
6608 \XC@c@v@wave@hsb{-.0166667}{7.33333}4{}\else
6609 \ifdim\@tempdima<490\p@
6610 \XC@c@v@wave@hsb{.02}{-8.8}4-\else
6611 \ifdim\@tempdima<510\p@
6612 \XC@c@v@wave@hsb{-.05}{25.5}2{}\else
6613 \ifdim\@tempdima<580\p@
6614 \XC@c@v@wave@hsb{.0142857}{-7.28571}2-\else
6615 \ifdim\@tempdima<645\p@
6616 \XC@c@v@wave@hsb{-.0153846}{9.92308}0{}\else
6617 \dimen@\z@ \fi\fi\fi\fi\fi
6618 \divide\dimen@6\relax
6619 \edef\@@tmp{\strip@pt\dimen@,1,}%
6620 % \end{macrocode}
6621 %
6622 % Calculate brightness:
6623 % \begin{macrocode}
6624 \ifdim\@tempdima<420\p@
6625 \XC@c@v@wave@hsb{.0175}{-6.35}0{}\else
6626 \ifdim\@tempdima>700\p@
6627 \XC@c@v@wave@hsb{-.00875}{7.125}0{}\else
6628 \dimen@\p@ \fi\fi
6629 \edef\@@tmp{\@@tmp\strip@pt\dimen@}}
6630 % \end{macrocode}
6631 % \end{macro}
6632 %
6633 % \begin{macro}{\XC@c@v@wave@hsb}
6634 % \marg{factor}\marg{const}\marg{offset}\marg{sign}\\
6635 % Calculates $\Meta{offset} + \Meta{sign}\cdot\varrho\bigl(\Meta{const} + \Meta{factor}\cdot\lambda\bigr)$, where $\varrho$ is the reduction function.
6636 % The result is stored in |\dimen@|.
6637 % \begin{macrocode}
6638 \def\XC@c@v@wave@hsb#1#2#3#4%
6639 {\dimen@#1\@tempdima \advance\dimen@#2\p@
6640 \XC@calcR{\strip@pt\dimen@}\@tempa
6641 \dimen@#4\@tempa\p@ \advance\dimen@#3\p@}
6642 % \end{macrocode}
6643 % \end{macro}
6644 %
6645 %
6646 % \subsubsection{Color complement}
6647 %
6648 % \begin{macro}{\XC@cnv@cmyk@compl}
6649 % \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|\Meta{black}|,|
6650 % \begin{macrocode}
6651 \def\XC@cnv@cmyk@compl#1,#2,#3,#4,%
6652 {\XC@cnv@cmyk@cmy#1,#2,#3,#4,%
6653 \expandafter\XC@calc@\@@tmp,,:C\expandafter\XC@cnv@cmy@cmyk\@@tmp,}
6654 % \end{macrocode}
6655 % \end{macro}
6656 %
6657 % \begin{macro}{\XC@cnv@hsb@compl}
6658 % \Meta{hue}|,|\Meta{saturation}|,|\Meta{brightness}|,|
6659 % \begin{macrocode}
6660 \def\XC@cnv@hsb@compl#1,#2,#3,%
6661 {\lshiftset\dimen@{#1}\advance\dimen@\ifdim\dimen@<5\p@-\fi-5\p@
6662 \rshift\dimen@ \edef\@@tmp{\strip@pt\dimen@}%
6663 \lshiftset\dimen@{#3}\@tempdima#2\dimen@
6664 \@tempdimb\@tempdima \advance\@tempdimb10\p@ \advance\@tempdimb-\dimen@
6665 \ifdim\@tempdimb=\z@
6666 \edef\@@tmp{\@@tmp,0,0}%
6667 \else
6668 \rdivide\@tempdima\@tempdimb \rshift\@tempdimb
6669 \edef\@@tmp{\@@tmp,\strip@pt\@tempdima,\strip@pt\@tempdimb}%
6670 \fi}
6671 % \end{macrocode}
6672 % \end{macro}
6673 %
6674 %
6675 %
6676 % \subsection{Color initialisation}
6677 %
6678 % \subsubsection{Support for missing color models}
6679 %
6680 % These macros provide generic support for missing color models in specific drivers.
6681 % For example, \File{pdftex.def} does not support the \Model{hsb} model.
6682 % It is assumed that at least one of the models \Model{rgb}, \Model{RGB}, \Model{HTML}, \Model{hsb}, \Model{Hsb}, \Model{HSB}, \Model{cmy}, \Model{cmyk}, \Model{gray}, \Model{Gray} exists.
6683 %
6684 % \begin{macro}{\substitutecolormodel}
6685 % \marg{source model}\marg{target model-list}\\
6686 % Substitute \Meta{source model} by the first actually present model from \Meta{target model-list}:
6687 % each reference to the driver-specific command |\color@|\Meta{source model} is replaced by a color model conversion, followed by the driver-specific command |\color@|\Meta{target model}.
6688 % \begin{macrocode}
6689 \def\substitutecolormodel#1#2%
6690 {\XC@sdef\XC@@tmp{\expandafter\XC@substitutecolormodel#2/ignore/\@nnil}%
6691 \ifx\XC@@tmp\XC@mod@ignore
6692 \XC@let@cN{color@#1}\color@ignore
6693 \else
6694 \expandafter\edef\csname color@#1\endcsname##1##2%
6695 {\noexpand\convertcolorspec
6696 \expandafter\noexpand\csname XC@mod@#1\endcsname{##2}%
6697 \expandafter\noexpand\csname XC@mod@\XC@@tmp\endcsname
6698 \noexpand\XC@@tmp\noexpand\expandafter
6699 \expandafter\noexpand\csname color@\XC@@tmp\endcsname
6700 \noexpand\expandafter##1\noexpand\expandafter{\noexpand\XC@@tmp}}%
6701 \fi
6702 \expandafter\xglobalize@\csname color@#1\endcsname \xglobal@stop
6703 \PackageInfo{xcolor}{Model `#1' substituted by `\XC@@tmp'}}
6704 % \end{macrocode}
6705 %
6706 % \begin{macrocode}
6707 \def\XC@substitutecolormodel#1/%
6708 {\@ifundefinedmodel{#1}{\XC@substitutecolormodel}{#1\remove@to@nnil}}
6709 % \end{macrocode}
6710 % \end{macro}
6711 %
6712 % \begin{macro}{\color@ignore}
6713 % \marg{cmd}\marg{spec}\\
6714 % Empty color model: no driver-specific representation at all.
6715 % \begin{macrocode}
6716 \def\color@ignore#1#2{\def#1{}}
6717 % \end{macrocode}
6718 % \end{macro}
6719 %
6720 % \begin{macro}{\color@rgb}
6721 % \marg{cmd}\marg{spec}\\
6722 % Takes the color specification \Meta{spec}, turns it into a driver-specific representation and puts the result into the macro \Meta{cmd}.
6723 % For example, if \File{dvips.def} is loaded, then |\color@rgb\foo{1,0,0}| will be equivalent to |\def\foo{rgb 1 0 0}|.
6724 % In the case of \File{pdftex.def}, it will act like |\def\foo{1 0 0 rg 1 0 0 RG}| instead.
6725 % \begin{macrocode}
6726 \@ifundefinedmodel{rgb}%
6727 {\substitutecolormodel{rgb}{RGB/HTML/hsb/Hsb/HSB/cmy/cmyk/gray/Gray}}{}
6728 % \end{macrocode}
6729 % \end{macro}
6730 %
6731 % \begin{macro}{\color@cmyk}
6732 % \marg{cmd}\marg{spec}
6733 % \begin{macrocode}
6734 \@ifundefinedmodel{cmyk}{\substitutecolormodel{cmyk}{cmy/rgb}}{}
6735 % \end{macrocode}
6736 % \end{macro}
6737 %
6738 % \begin{macro}{\color@cmy}
6739 % \marg{cmd}\marg{spec}
6740 % \begin{macrocode}
6741 \@ifundefinedmodel{cmy}%
6742 {\PackageInfo{xcolor}{Model `cmy' substituted by `cmy0'}
6743 \def\color@cmy#1#2{\color@cmyk#1{#2,0}}}{}
6744 % \end{macrocode}
6745 % \end{macro}
6746 %
6747 % \begin{macro}{\color@hsb}
6748 % \marg{cmd}\marg{spec}\\
6749 % Since the \Option{dvipdfm} and \Option{textures} drivers only pretend to support \Model{hsb}, we have to check for these drivers.
6750 % \begin{macrocode}
6751 \@ifundefinedmodel{hsb}{\@tempswatrue}%
6752 {\XC@ifcase\XC@@drv{{dvipdfm,textures}\@tempswatrue}\@tempswafalse}
6753 \if@tempswa
6754 \substitutecolormodel{hsb}{Hsb/HSB/rgb}
6755 \fi
6756 % \end{macrocode}
6757 % \end{macro}
6758 %
6759 % \begin{macro}{\color@RGB}
6760 % \marg{cmd}\marg{spec}\\
6761 % If the model is supported and |\rangeRGB| equals 255, we stick to the algorithm provided by the driver.
6762 % \begin{macrocode}
6763 \@ifundefinedmodel{RGB}%
6764 {\substitutecolormodel{RGB}{HTML/rgb}}
6765 {\PackageInfo{xcolor}{Model `RGB' extended}
6766 \let\XC@color@RGB\color@RGB
6767 \def\color@RGB#1#2%
6768 {\relax\ifnum\rangeRGB=255
6769 \XC@color@RGB#1{#2}%
6770 \else
6771 \convertcolorspec\XC@mod@RGB{#2}\XC@mod@rgb\XC@@tmp
6772 \expandafter\color@rgb\expandafter#1\expandafter{\XC@@tmp}%
6773 \fi}}
6774 % \end{macrocode}
6775 % \end{macro}
6776 %
6777 % \begin{macro}{\color@gray}
6778 % \begin{macro}{\color@HTML}
6779 % \begin{macro}{\color@Hsb}
6780 % \begin{macro}{\color@tHsb}
6781 % \begin{macro}{\color@HSB}
6782 % \begin{macro}{\color@Gray}
6783 % \begin{macro}{\color@wave}
6784 % \marg{cmd}\marg{spec}
6785 % \begin{macrocode}
6786 \@ifundefinedmodel{gray}{\substitutecolormodel{gray}{Gray/rgb}}{}
6787 \@ifundefinedmodel{HTML}{\substitutecolormodel{HTML}{rgb}}{}
6788 \@ifundefinedmodel{Hsb}{\substitutecolormodel{Hsb}{hsb}}{}
6789 \@ifundefinedmodel{tHsb}{\substitutecolormodel{tHsb}{hsb}}{}
6790 \@ifundefinedmodel{HSB}{\substitutecolormodel{HSB}{hsb}}{}
6791 \@ifundefinedmodel{Gray}{\substitutecolormodel{Gray}{gray}}{}
6792 \@ifundefinedmodel{wave}{\substitutecolormodel{wave}{hsb}}{}
6793 % \end{macrocode}
6794 % \end{macro}
6795 % \end{macro}
6796 % \end{macro}
6797 % \end{macro}
6798 % \end{macro}
6799 % \end{macro}
6800 % \end{macro}
6801 %
6802 %
6803 % \subsubsection{\Index{PostScript}-related stuff}
6804 %
6805 % \begin{macro}{\XC@getcolor}
6806 % \marg{color}\marg{cmd}\\
6807 % \marg{color command}\marg{cmd}\\
6808 % |{|\oarg{model}\marg{spec}|}|\marg{cmd}\\
6809 % Transformation of a color, given by the first argument, especially needed for \Package{pstricks}.
6810 % The result will always be an internal color representation (as described in section \vref{sec.definition}) and is stored in \Meta{cmd}.
6811 % There are different ways of specifying the color:
6812 % \begin{itemize}
6813 % \item \Meta{color} is a color name, expression, etc., e.g., |\XC@getcolor{green!50}\foo|;
6814 % \item \Meta{color command} is a macro whose \emph{first level} expansion is an internal color representation, e.g., |\XC@getcolor\pslinecolor\foo|;
6815 % \item \Meta{model} and \Meta{spec} provide, as usual, explicit parameter specifications.
6816 % \end{itemize}
6817 % \begin{macrocode}
6818 \def\XC@getcolor#1#2%
6819 {\begingroup\toks@{#1}\XC@getc@lor#1\XC@@\aftergroupdef#2{\@@tmp}}
6820 % \end{macrocode}
6821 %
6822 % Check whether the argument consists of one or more tokens.
6823 % In the first case, expand by one level and go to next check.
6824 % In the second case, assume it's a \Meta{color} and simulate its display, but without performing the real |\set@color| command (which would insert |\special|s, possibly causing trouble with blank spaces).
6825 % This simulation ensures that we get exactly the same color --- including all blending, masking --- as if we had executed an explicit |\color| command at that point.
6826 % \begin{macrocode}
6827 \def\XC@getc@lor#1#2\XC@@
6828 {\@ifxempty{#2}%
6829 {\expandafter\XC@getc@l@r#1\XC@@}%
6830 {\let\set@color\relax
6831 \ifx#1[%
6832 \expandafter\@undeclaredcolor\the\toks@\else
6833 \expandafter\@declaredcolor\expandafter{\the\toks@}\fi
6834 \let\@@tmp\XC@current@color}}
6835 % \end{macrocode}
6836 %
6837 % Check whether the first token is |\xcolor@|.
6838 % In that case, |#1#2| is assumed to be a complete internal color representation.
6839 % Otherwise, perform a simulation as described before.
6840 % \begin{macrocode}
6841 \def\XC@getc@l@r#1#2\XC@@
6842 {\ifx#1\xcolor@
6843 \def\@@tmp{\xcolor@#2}%
6844 \else
6845 \let\set@color\relax
6846 \expandafter\@declaredcolor\expandafter{\the\toks@}%
6847 \let\@@tmp\XC@current@color
6848 \fi}
6849 % \end{macrocode}
6850 % \end{macro}
6851 %
6852 % \begin{macro}{\XC@usecolor}
6853 % \marg{name}\\
6854 % \marg{color command}\\
6855 % Transformation of a color into \Index{PostScript} code.
6856 % The argument may be either a command whose \emph{first-level} expansion is an internal color representation (e.g., the outcome of an |\XC@getcolor| command: |\XC@usecolor\pslinecolor|), or a \Meta{name} (e.g., |\XC@usecolor{green}|).
6857 % Note that non-trivial color expressions like |green!50| are forbidden and that |\XC@usecolor| is fully expandable, for example, |\edef\foo{\XC@usecolor{green}}| is valid.
6858 % \begin{macrocode}
6859 \def\XC@usecolor#1{\expandafter\XC@usec@lor#1\XC@@}
6860 \def\XC@usec@lor#1#2\XC@@
6861 {\ifx#1\xcolor@
6862 \expandafter\expandafter\expandafter\c@lor@to@ps#1#2\@@
6863 \else
6864 \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
6865 \expandafter\c@lor@to@ps\csname\@backslashchar color@#1#2\endcsname\@@
6866 \fi
6867 \space}
6868 % \end{macrocode}
6869 %
6870 % For compatibility reasons, we need the following command temporarily; however, |\XC@c@lor@to@ps| will disappear!
6871 % \begin{macrocode}
6872 \let\XC@c@lor@to@ps\XC@usecolor
6873 % \end{macrocode}
6874 % \end{macro}
6875 %
6876 % \begin{macrocode}
6877 \let\pst@getcolor\XC@getcolor
6878 \let\pst@usecolor\XC@usecolor
6879 % \end{macrocode}
6880 %
6881 %
6882 % \subsubsection{Whatsit \ldots}
6883 %
6884 % \begin{macro}{\c@lor@special}
6885 % Some drivers do not support all the features of this package.
6886 % They should always put a \Meta{whatsit} in the current list though.
6887 % The following macro has most of the features of |\special|, but does not put anything into the \File{.dvi} file.
6888 % It does write to the |log| file or the terminal (depending on the value of |#1|).
6889 % \begin{macrocode}
6890 \def\c@lor@special#1#2{\edef\@tempa{\write#1{#2}}\@tempa}
6891 % \end{macrocode}
6892 % \end{macro}
6893 %
6894 %
6895 % \subsubsection{Default color}
6896 %
6897 % \begin{macro}{\normalcolor}
6898 % |\normalcolor| is defined (to |\relax|) in the \LaTeX\ kernel, so it is safe to use this in macros that may possibly be used in conjunction with color.
6899 % It will have no effect until the \XCP{} is also loaded.
6900 % \begin{macrocode}
6901 \protected\def\normalcolor{%
6902 \let\current@color\default@color
6903 \let\XC@current@color\XC@default@color\XC@display}
6904 \AtBeginDocument{\let\XC@default@color\XC@current@color}
6905 % \end{macrocode}
6906 % \end{macro}
6907 %
6908 % \begin{macro}{\default@color}
6909 % Internal macro to store the `default' color used by |\normalcolor|.
6910 % \begin{macrocode}
6911 \AtBeginDocument{\let\default@color\current@color}
6912 % \end{macrocode}
6913 % \end{macro}
6914 % |\current@color| (which is the expansion of |\XC@current@color|) contains an internal representation of the color at this point in the document.
6915 % This can only be an approximation to the truth as the `macro layer' of \TeX\ does not know where the output routine is going to re-insert floats.
6916 % This is why drivers must maintain their own stack of colors in order to fully support these commands.
6917 %
6918 %
6919 % \subsubsection{Driver-specific definitions for named colors}
6920 %
6921 % \begin{macro}{\c@lor@@named}
6922 % \begin{macro}{\define@color@named}
6923 % We have to modify a few driver-specific commands in order to avoid generation of superfluous macros.
6924 % \begin{macrocode}
6925 \XC@ifcase\XC@@drv
6926 {{dvipdf,dvipdfm,dvipdfmx,dvips,pctex32}%
6927 {\def\c@lor@@named#1,#2,#3\@@#4%
6928 {\edef#4{\expandafter\expandafter\expandafter\@thirdoffive
6929 \csname\@backslashchar color@#1\endcsname}}
6930 \def\define@color@named#1#2%
6931 {\@namedef{\@backslashchar color@#1}{{}{}{ \colornameprefix#1}{}{}}}}%
6932 % \end{macrocode}
6933 %
6934 % \begin{macrocode}
6935 {dvipsone,luatex,pctexps,pdftex,tcidvi,truetex,vtex,xetex}%
6936 {\def\c@lor@@named#1,#2,#3\@@#4%
6937 {\edef#4{\expandafter\expandafter\expandafter\@thirdoffive
6938 \csname\@backslashchar color@#1\endcsname}}
6939 \def\define@color@named#1#2%
6940 {\let\@@cls\@empty\@namedef{\@backslashchar color@#1}{{}{}{#2}{}{}}}}%
6941 % \end{macrocode}
6942 %
6943 % \begin{macrocode}
6944 {textures}%
6945 {\def\c@lor@@named#1,#2,#3\@@#4%
6946 {\edef\@tempa{\color@P@custom{#1}{\if!#2!1\else#2\fi}}%
6947 \expandafter\def\expandafter#4\@tempa}
6948 \def\define@color@named#1#2%
6949 {\edef\@tempa{{#1}{#2}}\expandafter\AddCustomColor\@tempa}
6950 \def\c@lor@ps@#1 #2\@@
6951 {\expandafter\expandafter\expandafter\expandafter\expandafter
6952 \expandafter\expandafter\c@lor@to@ps@
6953 \csname\@backslashchar color@#1\expandafter\endcsname\space
6954 #2. \@@{#1}}}%
6955 % \end{macrocode}
6956 %
6957 % \begin{macrocode}
6958 }{}
6959 % \end{macrocode}
6960 % \end{macro}
6961 % \end{macro}
6962 %
6963 %
6964 % \subsubsection{Basic color definitions}
6965 %
6966 % \Model{rgb}-minded colors.\footnote{Generic definitions:
6967 % \Color{brown} = \Color{violet}|!|50|!|\Color{yellow},
6968 % \Color{lime} = \Color{green}|!|25|!|\Color{yellow},
6969 % \Color{orange} = \Color{red}|!|50|!|\Color{yellow},
6970 % \Color{pink} = \Color{red}|!|25,
6971 % \Color{purple} = \Color{violet}|!|50|!|\Color{red},
6972 % \Color{teal} = \Color{green}|!|50|!|\Color{blue},
6973 % \Color{violet} = \Color{blue}|!|50|!|\Color{red}.}
6974 % \begin{macrocode}
6975 \definecolorset{rgb/hsb/cmyk/gray}{}{}%
6976 {red,1,0,0/0,1,1/0,1,1,0/.3;%
6977 green,0,1,0/.33333,1,1/1,0,1,0/.59;%
6978 blue,0,0,1/.66667,1,1/1,1,0,0/.11;%
6979 brown,.75,.5,.25/.083333,.66667,.75/0,.25,.5,.25/.5475;%
6980 lime,.75,1,0/.20833,1,1/.25,0,1,0/.815;%
6981 orange,1,.5,0/.083333,1,1/0,.5,1,0/.595;%
6982 pink,1,.75,.75/0,.25,1/0,.25,.25,0/.825;%
6983 purple,.75,0,.25/.94444,1,.75/0,.75,.5,.25/.2525;%
6984 teal,0,.5,.5/.5,1,.5/.5,0,0,.5/.35;%
6985 violet,.5,0,.5/.83333,1,.5/0,.5,0,.5/.205}%
6986 % \end{macrocode}
6987 %
6988 % \Model{cmyk}-minded colors.\footnote{Generic definitions:
6989 % \Color{olive} = \Color{red}|!|50|!|\Color{green}.}
6990 % \begin{macrocode}
6991 \definecolorset{cmyk/rgb/hsb/gray}{}{}%
6992 {cyan,1,0,0,0/0,1,1/.5,1,1/.7;%
6993 magenta,0,1,0,0/1,0,1/.83333,1,1/.41;%
6994 yellow,0,0,1,0/1,1,0/.16667,1,1/.89;%
6995 olive,0,0,1,.5/.5,.5,0/.16667,1,.5/.39}
6996 % \end{macrocode}
6997 %
6998 % \Model{gray}-minded colors.
6999 % \begin{macrocode}
7000 \definecolorset{gray/rgb/hsb/cmyk}{}{}%
7001 {black,0/0,0,0/0,0,0/0,0,0,1;%
7002 darkgray,.25/.25,.25,.25/0,0,.25/0,0,0,.75;%
7003 gray,.5/.5,.5,.5/0,0,.5/0,0,0,.5;%
7004 lightgray,.75/.75,.75,.75/0,0,.75/0,0,0,.25;%
7005 white,1/1,1,1/0,0,1/0,0,0,0}
7006 % \end{macrocode}
7007 %
7008 % Load predefined sets of colors (e.g., \File{dvipsnam.def}).
7009 % \begin{macrocode}
7010 \XC@@names
7011 % \end{macrocode}
7012 %
7013 %
7014 % \subsubsection{Finale}
7015 %
7016 % Clear color stack and restore catcodes.
7017 % \begin{macrocode}
7018 \AtBeginDocument{\let\XC@@stack\@empty}
7019 \let\colornameprefix\XC@@nameprefix
7020 \XC@catcodes
7021 % \end{macrocode}
7022 %
7023 % \begin{macrocode}
7024 \csname xcolorcmd\endcsname
7025 \color{black}
7026 %</package>
7027 % \end{macrocode}
7028 %
7029 %
7030 % \iffalse
7031 %-------------------------------------------------------------------------------
7032 % \fi
7033 %
7034 % \subsection{Auxiliary definitions}
7035 %
7036 % \subsubsection{\Index{PostScript} prologue file \File{xcolor.pro}}
7037 %
7038 % \begin{macrocode}
7039 %<*dvips>
7040 userdict begin
7041 /setcmycolor{0 setcmykcolor}def
7042 /XCbd{bind def}bind def
7043 /XCed{exch def}XCbd
7044 % \end{macrocode}
7045 %
7046 % \Index{PostScript} version of |\providecommand|.
7047 % \begin{macrocode}
7048 /XCdef{exch dup TeXDict exch known{pop pop}{XCed}ifelse}XCbd
7049 % \end{macrocode}
7050 %
7051 % \Index{PostScript} version of |\providecolor|.
7052 % \begin{macrocode}
7053 /XCsetcolor{cvx counttomark array astore cvx exch pop XCdef}XCbd
7054 % \end{macrocode}
7055 %
7056 % Now define model-dependent color definition commands.
7057 % \begin{macrocode}
7058 /XCcmy{mark exch exec/setcmycolor XCsetcolor}XCbd
7059 /XCcmyk{mark exch exec/setcmykcolor XCsetcolor}XCbd
7060 /XCgray{mark exch exec/setgray XCsetcolor}XCbd
7061 /XChsb{mark exch exec/sethsbcolor XCsetcolor}XCbd
7062 /XCrgb{mark exch exec/setrgbcolor XCsetcolor}XCbd
7063 % \end{macrocode}
7064 %
7065 % This is a fix for \File{special.pro}'s behaviour to perform a |0 setgray| during |normalscale|.
7066 % \begin{macrocode}
7067 /XCfixnormalscale{/normalscale{Resolution 72 div VResolution 72 div neg
7068 scale magscale{DVImag dup scale}if}def}def
7069 % \end{macrocode}
7070 %
7071 % Grouping operators.
7072 % We have to call |XCfixnormalscale| since |normalscale| is invoked by |@beginspecial| as defined by \File{special.pro}.
7073 % \begin{macrocode}
7074 /XC!b{save XCfixnormalscale}XCbd
7075 /XC!e{restore}XCbd
7076 % \end{macrocode}
7077 %
7078 % Scale `sp' coordinates back to `bp' units.
7079 % \begin{macrocode}
7080 /XCsp2bp{1 65781.76 div dup scale}XCbd
7081 % \end{macrocode}
7082 %
7083 % \begin{macro}{XCsetline}
7084 % \meta{linewidth} |XCsetline|\\
7085 % Common line definition.
7086 % \begin{macrocode}
7087 /XCsetline
7088 {setlinewidth [] 0 setdash 2 setlinecap 0 setlinejoin 4 setmiterlimit}XCbd
7089 % \end{macrocode}
7090 % \end{macro}
7091 %
7092 % \begin{macro}{XCboxframe}
7093 % \meta{linewidth} \meta{width} \meta{height} \meta{depth} |XCboxframe|\\
7094 % Draw a frame in `sp' coordinates using LanguageLevel~2.
7095 % \begin{macrocode}
7096 /XCboxframe{/d XCed/h XCed/w XCed/l XCed w 0 gt{h d neg gt{l 0 gt
7097 {XCsp2bp l XCsetline
7098 l 2 div dup translate
7099 0 d neg w l sub h l sub d add rectstroke}if}if}if}XCbd
7100 % \end{macrocode}
7101 % \end{macro}
7102 %
7103 % \begin{macro}{XCcolorblock}
7104 % \meta{width} \meta{height} \meta{depth} |XCcolorblock|\\
7105 % Draw a colored box in `sp' coordinates using LanguageLevel~2.
7106 % \begin{macrocode}
7107 /XCcolorblock{/d XCed/h XCed/w XCed w 0 gt{h d neg gt
7108 {XCsp2bp 0 XCsetline
7109 0 d neg w h d add rectfill}if}if}XCbd
7110 % \end{macrocode}
7111 % \end{macro}
7112 %
7113 % \begin{macrocode}
7114 end
7115 %</dvips>
7116 % \end{macrocode}
7117 %
7118 %
7119 % \clearpage
7120 % \Finale
7121 % \endinput
7122 %
7123 %
7124 % \iffalse
7125 %-------------------------------------------------------------------------------
7126 %<*svgnames|x11names|hksknames|hksnnames|hksznames|pmsnames|ralnames>
7127 \def\colornameprefix{XC@}
7128 %</svgnames|x11names|hksknames|hksnnames|hksznames|pmsnames|ralnames>
7129 %
7130 %<*svgnames>
7131 \preparecolorset{rgb}{}{}{%
7132 AliceBlue,.94,.972,1;%
7133 AntiqueWhite,.98,.92,.844;%
7134 Aqua,0,1,1;%
7135 Aquamarine,.498,1,.83;%
7136 Azure,.94,1,1;%
7137 Beige,.96,.96,.864;%
7138 Bisque,1,.894,.77;%
7139 Black,0,0,0;%
7140 BlanchedAlmond,1,.92,.804;%
7141 Blue,0,0,1;%
7142 BlueViolet,.54,.17,.888;%
7143 Brown,.648,.165,.165;%
7144 BurlyWood,.87,.72,.53;%
7145 CadetBlue,.372,.62,.628;%
7146 Chartreuse,.498,1,0;%
7147 Chocolate,.824,.41,.116;%
7148 Coral,1,.498,.312;%
7149 CornflowerBlue,.392,.585,.93;%
7150 Cornsilk,1,.972,.864;%
7151 Crimson,.864,.08,.235;%
7152 Cyan,0,1,1;%
7153 DarkBlue,0,0,.545;%
7154 DarkCyan,0,.545,.545;%
7155 DarkGoldenrod,.72,.525,.044;%
7156 DarkGray,.664,.664,.664;%
7157 DarkGreen,0,.392,0;%
7158 DarkGrey,.664,.664,.664;%
7159 DarkKhaki,.74,.716,.42;%
7160 DarkMagenta,.545,0,.545;%
7161 DarkOliveGreen,.332,.42,.185;%
7162 DarkOrange,1,.55,0;%
7163 DarkOrchid,.6,.196,.8;%
7164 DarkRed,.545,0,0;%
7165 DarkSalmon,.912,.59,.48;%
7166 DarkSeaGreen,.56,.736,.56;%
7167 DarkSlateBlue,.284,.24,.545;%
7168 DarkSlateGray,.185,.31,.31;%
7169 DarkSlateGrey,.185,.31,.31;%
7170 DarkTurquoise,0,.808,.82;%
7171 DarkViolet,.58,0,.828;%
7172 DeepPink,1,.08,.576;%
7173 DeepSkyBlue,0,.75,1;%
7174 DimGray,.41,.41,.41;%
7175 DimGrey,.41,.41,.41;%
7176 DodgerBlue,.116,.565,1;%
7177 FireBrick,.698,.132,.132;%
7178 FloralWhite,1,.98,.94;%
7179 ForestGreen,.132,.545,.132;%
7180 Fuchsia,1,0,1;%
7181 Gainsboro,.864,.864,.864;%
7182 GhostWhite,.972,.972,1;%
7183 Gold,1,.844,0;%
7184 Goldenrod,.855,.648,.125;%
7185 Gray,.5,.5,.5;%
7186 Green,0,.5,0;%
7187 GreenYellow,.68,1,.185;%
7188 Grey,.5,.5,.5;%
7189 Honeydew,.94,1,.94;%
7190 HotPink,1,.41,.705;%
7191 IndianRed,.804,.36,.36;%
7192 Indigo,.294,0,.51;%
7193 Ivory,1,1,.94;%
7194 Khaki,.94,.9,.55;%
7195 Lavender,.9,.9,.98;%
7196 LavenderBlush,1,.94,.96;%
7197 LawnGreen,.488,.99,0;%
7198 LemonChiffon,1,.98,.804;%
7199 LightBlue,.68,.848,.9;%
7200 LightCoral,.94,.5,.5;%
7201 LightCyan,.88,1,1;%
7202 LightGoldenrod,.933,.867,.51;%
7203 LightGoldenrodYellow,.98,.98,.824;%
7204 LightGray,.828,.828,.828;%
7205 LightGreen,.565,.932,.565;%
7206 LightGrey,.828,.828,.828;%
7207 LightPink,1,.712,.756;%
7208 LightSalmon,1,.628,.48;%
7209 LightSeaGreen,.125,.698,.668;%
7210 LightSkyBlue,.53,.808,.98;%
7211 LightSlateBlue,.518,.44,1;%
7212 LightSlateGray,.468,.532,.6;%
7213 LightSlateGrey,.468,.532,.6;%
7214 LightSteelBlue,.69,.77,.87;%
7215 LightYellow,1,1,.88;%
7216 Lime,0,1,0;%
7217 LimeGreen,.196,.804,.196;%
7218 Linen,.98,.94,.9;%
7219 Magenta,1,0,1;%
7220 Maroon,.5,0,0;%
7221 MediumAquamarine,.4,.804,.668;%
7222 MediumBlue,0,0,.804;%
7223 MediumOrchid,.73,.332,.828;%
7224 MediumPurple,.576,.44,.86;%
7225 MediumSeaGreen,.235,.7,.444;%
7226 MediumSlateBlue,.484,.408,.932;%
7227 MediumSpringGreen,0,.98,.604;%
7228 MediumTurquoise,.284,.82,.8;%
7229 MediumVioletRed,.78,.084,.52;%
7230 MidnightBlue,.098,.098,.44;%
7231 MintCream,.96,1,.98;%
7232 MistyRose,1,.894,.884;%
7233 Moccasin,1,.894,.71;%
7234 NavajoWhite,1,.87,.68;%
7235 Navy,0,0,.5;%
7236 NavyBlue,0,0,.5;%
7237 OldLace,.992,.96,.9;%
7238 Olive,.5,.5,0;%
7239 OliveDrab,.42,.556,.136;%
7240 Orange,1,.648,0;%
7241 OrangeRed,1,.27,0;%
7242 Orchid,.855,.44,.84;%
7243 PaleGoldenrod,.932,.91,.668;%
7244 PaleGreen,.596,.985,.596;%
7245 PaleTurquoise,.688,.932,.932;%
7246 PaleVioletRed,.86,.44,.576;%
7247 PapayaWhip,1,.936,.835;%
7248 PeachPuff,1,.855,.725;%
7249 Peru,.804,.52,.248;%
7250 Pink,1,.752,.796;%
7251 Plum,.868,.628,.868;%
7252 PowderBlue,.69,.88,.9;%
7253 Purple,.5,0,.5;%
7254 Red,1,0,0;%
7255 RosyBrown,.736,.56,.56;%
7256 RoyalBlue,.255,.41,.884;%
7257 SaddleBrown,.545,.27,.075;%
7258 Salmon,.98,.5,.448;%
7259 SandyBrown,.956,.644,.376;%
7260 SeaGreen,.18,.545,.34;%
7261 Seashell,1,.96,.932;%
7262 Sienna,.628,.32,.176;%
7263 Silver,.752,.752,.752;%
7264 SkyBlue,.53,.808,.92;%
7265 SlateBlue,.415,.352,.804;%
7266 SlateGray,.44,.5,.565;%
7267 SlateGrey,.44,.5,.565;%
7268 Snow,1,.98,.98;%
7269 SpringGreen,0,1,.498;%
7270 SteelBlue,.275,.51,.705;%
7271 Tan,.824,.705,.55;%
7272 Teal,0,.5,.5;%
7273 Thistle,.848,.75,.848;%
7274 Tomato,1,.39,.28;%
7275 Turquoise,.25,.88,.815;%
7276 Violet,.932,.51,.932;%
7277 VioletRed,.816,.125,.565;%
7278 Wheat,.96,.87,.7;%
7279 White,1,1,1;%
7280 WhiteSmoke,.96,.96,.96;%
7281 Yellow,1,1,0;%
7282 YellowGreen,.604,.804,.196}
7283 %</svgnames>
7284 %
7285 %<*x11names>
7286 \preparecolorset{rgb}{}{}{%
7287 AntiqueWhite1,1,.936,.86;%
7288 AntiqueWhite2,.932,.875,.8;%
7289 AntiqueWhite3,.804,.752,.69;%
7290 AntiqueWhite4,.545,.512,.47;%
7291 Aquamarine1,.498,1,.83;%
7292 Aquamarine2,.464,.932,.776;%
7293 Aquamarine3,.4,.804,.668;%
7294 Aquamarine4,.27,.545,.455;%
7295 Azure1,.94,1,1;%
7296 Azure2,.88,.932,.932;%
7297 Azure3,.756,.804,.804;%
7298 Azure4,.512,.545,.545;%
7299 Bisque1,1,.894,.77;%
7300 Bisque2,.932,.835,.716;%
7301 Bisque3,.804,.716,.62;%
7302 Bisque4,.545,.49,.42;%
7303 Blue1,0,0,1;%
7304 Blue2,0,0,.932;%
7305 Blue3,0,0,.804;%
7306 Blue4,0,0,.545;%
7307 Brown1,1,.25,.25;%
7308 Brown2,.932,.23,.23;%
7309 Brown3,.804,.2,.2;%
7310 Brown4,.545,.136,.136;%
7311 Burlywood1,1,.828,.608;%
7312 Burlywood2,.932,.772,.57;%
7313 Burlywood3,.804,.668,.49;%
7314 Burlywood4,.545,.45,.332;%
7315 CadetBlue1,.596,.96,1;%
7316 CadetBlue2,.556,.898,.932;%
7317 CadetBlue3,.48,.772,.804;%
7318 CadetBlue4,.325,.525,.545;%
7319 Chartreuse1,.498,1,0;%
7320 Chartreuse2,.464,.932,0;%
7321 Chartreuse3,.4,.804,0;%
7322 Chartreuse4,.27,.545,0;%
7323 Chocolate1,1,.498,.14;%
7324 Chocolate2,.932,.464,.13;%
7325 Chocolate3,.804,.4,.112;%
7326 Chocolate4,.545,.27,.075;%
7327 Coral1,1,.448,.336;%
7328 Coral2,.932,.415,.312;%
7329 Coral3,.804,.356,.27;%
7330 Coral4,.545,.244,.185;%
7331 Cornsilk1,1,.972,.864;%
7332 Cornsilk2,.932,.91,.804;%
7333 Cornsilk3,.804,.785,.694;%
7334 Cornsilk4,.545,.532,.47;%
7335 Cyan1,0,1,1;%
7336 Cyan2,0,.932,.932;%
7337 Cyan3,0,.804,.804;%
7338 Cyan4,0,.545,.545;%
7339 DarkGoldenrod1,1,.725,.06;%
7340 DarkGoldenrod2,.932,.68,.055;%
7341 DarkGoldenrod3,.804,.585,.048;%
7342 DarkGoldenrod4,.545,.396,.03;%
7343 DarkOliveGreen1,.792,1,.44;%
7344 DarkOliveGreen2,.736,.932,.408;%
7345 DarkOliveGreen3,.635,.804,.352;%
7346 DarkOliveGreen4,.43,.545,.24;%
7347 DarkOrange1,1,.498,0;%
7348 DarkOrange2,.932,.464,0;%
7349 DarkOrange3,.804,.4,0;%
7350 DarkOrange4,.545,.27,0;%
7351 DarkOrchid1,.75,.244,1;%
7352 DarkOrchid2,.698,.228,.932;%
7353 DarkOrchid3,.604,.196,.804;%
7354 DarkOrchid4,.408,.132,.545;%
7355 DarkSeaGreen1,.756,1,.756;%
7356 DarkSeaGreen2,.705,.932,.705;%
7357 DarkSeaGreen3,.608,.804,.608;%
7358 DarkSeaGreen4,.41,.545,.41;%
7359 DarkSlateGray1,.592,1,1;%
7360 DarkSlateGray2,.552,.932,.932;%
7361 DarkSlateGray3,.475,.804,.804;%
7362 DarkSlateGray4,.32,.545,.545;%
7363 DeepPink1,1,.08,.576;%
7364 DeepPink2,.932,.07,.536;%
7365 DeepPink3,.804,.064,.464;%
7366 DeepPink4,.545,.04,.312;%
7367 DeepSkyBlue1,0,.75,1;%
7368 DeepSkyBlue2,0,.698,.932;%
7369 DeepSkyBlue3,0,.604,.804;%
7370 DeepSkyBlue4,0,.408,.545;%
7371 DodgerBlue1,.116,.565,1;%
7372 DodgerBlue2,.11,.525,.932;%
7373 DodgerBlue3,.094,.455,.804;%
7374 DodgerBlue4,.064,.305,.545;%
7375 Firebrick1,1,.19,.19;%
7376 Firebrick2,.932,.172,.172;%
7377 Firebrick3,.804,.15,.15;%
7378 Firebrick4,.545,.1,.1;%
7379 Gold1,1,.844,0;%
7380 Gold2,.932,.79,0;%
7381 Gold3,.804,.68,0;%
7382 Gold4,.545,.46,0;%
7383 Goldenrod1,1,.756,.145;%
7384 Goldenrod2,.932,.705,.132;%
7385 Goldenrod3,.804,.608,.112;%
7386 Goldenrod4,.545,.41,.08;%
7387 Green1,0,1,0;%
7388 Green2,0,.932,0;%
7389 Green3,0,.804,0;%
7390 Green4,0,.545,0;%
7391 Honeydew1,.94,1,.94;%
7392 Honeydew2,.88,.932,.88;%
7393 Honeydew3,.756,.804,.756;%
7394 Honeydew4,.512,.545,.512;%
7395 HotPink1,1,.43,.705;%
7396 HotPink2,.932,.415,.655;%
7397 HotPink3,.804,.376,.565;%
7398 HotPink4,.545,.228,.385;%
7399 IndianRed1,1,.415,.415;%
7400 IndianRed2,.932,.39,.39;%
7401 IndianRed3,.804,.332,.332;%
7402 IndianRed4,.545,.228,.228;%
7403 Ivory1,1,1,.94;%
7404 Ivory2,.932,.932,.88;%
7405 Ivory3,.804,.804,.756;%
7406 Ivory4,.545,.545,.512;%
7407 Khaki1,1,.965,.56;%
7408 Khaki2,.932,.9,.52;%
7409 Khaki3,.804,.776,.45;%
7410 Khaki4,.545,.525,.305;%
7411 LavenderBlush1,1,.94,.96;%
7412 LavenderBlush2,.932,.88,.898;%
7413 LavenderBlush3,.804,.756,.772;%
7414 LavenderBlush4,.545,.512,.525;%
7415 LemonChiffon1,1,.98,.804;%
7416 LemonChiffon2,.932,.912,.75;%
7417 LemonChiffon3,.804,.79,.648;%
7418 LemonChiffon4,.545,.536,.44;%
7419 LightBlue1,.75,.936,1;%
7420 LightBlue2,.698,.875,.932;%
7421 LightBlue3,.604,.752,.804;%
7422 LightBlue4,.408,.512,.545;%
7423 LightCyan1,.88,1,1;%
7424 LightCyan2,.82,.932,.932;%
7425 LightCyan3,.705,.804,.804;%
7426 LightCyan4,.48,.545,.545;%
7427 LightGoldenrod1,1,.925,.545;%
7428 LightGoldenrod2,.932,.864,.51;%
7429 LightGoldenrod3,.804,.745,.44;%
7430 LightGoldenrod4,.545,.505,.298;%
7431 LightPink1,1,.684,.725;%
7432 LightPink2,.932,.635,.68;%
7433 LightPink3,.804,.55,.585;%
7434 LightPink4,.545,.372,.396;%
7435 LightSalmon1,1,.628,.48;%
7436 LightSalmon2,.932,.585,.448;%
7437 LightSalmon3,.804,.505,.385;%
7438 LightSalmon4,.545,.34,.26;%
7439 LightSkyBlue1,.69,.888,1;%
7440 LightSkyBlue2,.644,.828,.932;%
7441 LightSkyBlue3,.552,.712,.804;%
7442 LightSkyBlue4,.376,.484,.545;%
7443 LightSteelBlue1,.792,.884,1;%
7444 LightSteelBlue2,.736,.824,.932;%
7445 LightSteelBlue3,.635,.71,.804;%
7446 LightSteelBlue4,.43,.484,.545;%
7447 LightYellow1,1,1,.88;%
7448 LightYellow2,.932,.932,.82;%
7449 LightYellow3,.804,.804,.705;%
7450 LightYellow4,.545,.545,.48;%
7451 Magenta1,1,0,1;%
7452 Magenta2,.932,0,.932;%
7453 Magenta3,.804,0,.804;%
7454 Magenta4,.545,0,.545;%
7455 Maroon1,1,.204,.7;%
7456 Maroon2,.932,.19,.655;%
7457 Maroon3,.804,.16,.565;%
7458 Maroon4,.545,.11,.385;%
7459 MediumOrchid1,.88,.4,1;%
7460 MediumOrchid2,.82,.372,.932;%
7461 MediumOrchid3,.705,.32,.804;%
7462 MediumOrchid4,.48,.215,.545;%
7463 MediumPurple1,.67,.51,1;%
7464 MediumPurple2,.624,.475,.932;%
7465 MediumPurple3,.536,.408,.804;%
7466 MediumPurple4,.365,.28,.545;%
7467 MistyRose1,1,.894,.884;%
7468 MistyRose2,.932,.835,.824;%
7469 MistyRose3,.804,.716,.71;%
7470 MistyRose4,.545,.49,.484;%
7471 NavajoWhite1,1,.87,.68;%
7472 NavajoWhite2,.932,.81,.63;%
7473 NavajoWhite3,.804,.7,.545;%
7474 NavajoWhite4,.545,.475,.37;%
7475 OliveDrab1,.752,1,.244;%
7476 OliveDrab2,.7,.932,.228;%
7477 OliveDrab3,.604,.804,.196;%
7478 OliveDrab4,.41,.545,.132;%
7479 Orange1,1,.648,0;%
7480 Orange2,.932,.604,0;%
7481 Orange3,.804,.52,0;%
7482 Orange4,.545,.352,0;%
7483 OrangeRed1,1,.27,0;%
7484 OrangeRed2,.932,.25,0;%
7485 OrangeRed3,.804,.215,0;%
7486 OrangeRed4,.545,.145,0;%
7487 Orchid1,1,.512,.98;%
7488 Orchid2,.932,.48,.912;%
7489 Orchid3,.804,.41,.79;%
7490 Orchid4,.545,.28,.536;%
7491 PaleGreen1,.604,1,.604;%
7492 PaleGreen2,.565,.932,.565;%
7493 PaleGreen3,.488,.804,.488;%
7494 PaleGreen4,.33,.545,.33;%
7495 PaleTurquoise1,.732,1,1;%
7496 PaleTurquoise2,.684,.932,.932;%
7497 PaleTurquoise3,.59,.804,.804;%
7498 PaleTurquoise4,.4,.545,.545;%
7499 PaleVioletRed1,1,.51,.67;%
7500 PaleVioletRed2,.932,.475,.624;%
7501 PaleVioletRed3,.804,.408,.536;%
7502 PaleVioletRed4,.545,.28,.365;%
7503 PeachPuff1,1,.855,.725;%
7504 PeachPuff2,.932,.796,.68;%
7505 PeachPuff3,.804,.688,.585;%
7506 PeachPuff4,.545,.468,.396;%
7507 Pink1,1,.71,.772;%
7508 Pink2,.932,.664,.72;%
7509 Pink3,.804,.57,.62;%
7510 Pink4,.545,.39,.424;%
7511 Plum1,1,.732,1;%
7512 Plum2,.932,.684,.932;%
7513 Plum3,.804,.59,.804;%
7514 Plum4,.545,.4,.545;%
7515 Purple1,.608,.19,1;%
7516 Purple2,.57,.172,.932;%
7517 Purple3,.49,.15,.804;%
7518 Purple4,.332,.1,.545;%
7519 Red1,1,0,0;%
7520 Red2,.932,0,0;%
7521 Red3,.804,0,0;%
7522 Red4,.545,0,0;%
7523 RosyBrown1,1,.756,.756;%
7524 RosyBrown2,.932,.705,.705;%
7525 RosyBrown3,.804,.608,.608;%
7526 RosyBrown4,.545,.41,.41;%
7527 RoyalBlue1,.284,.464,1;%
7528 RoyalBlue2,.264,.43,.932;%
7529 RoyalBlue3,.228,.372,.804;%
7530 RoyalBlue4,.152,.25,.545;%
7531 Salmon1,1,.55,.41;%
7532 Salmon2,.932,.51,.385;%
7533 Salmon3,.804,.44,.33;%
7534 Salmon4,.545,.298,.224;%
7535 SeaGreen1,.33,1,.624;%
7536 SeaGreen2,.305,.932,.58;%
7537 SeaGreen3,.264,.804,.5;%
7538 SeaGreen4,.18,.545,.34;%
7539 Seashell1,1,.96,.932;%
7540 Seashell2,.932,.898,.87;%
7541 Seashell3,.804,.772,.75;%
7542 Seashell4,.545,.525,.51;%
7543 Sienna1,1,.51,.28;%
7544 Sienna2,.932,.475,.26;%
7545 Sienna3,.804,.408,.224;%
7546 Sienna4,.545,.28,.15;%
7547 SkyBlue1,.53,.808,1;%
7548 SkyBlue2,.494,.752,.932;%
7549 SkyBlue3,.424,.65,.804;%
7550 SkyBlue4,.29,.44,.545;%
7551 SlateBlue1,.512,.435,1;%
7552 SlateBlue2,.48,.404,.932;%
7553 SlateBlue3,.41,.35,.804;%
7554 SlateBlue4,.28,.235,.545;%
7555 SlateGray1,.776,.888,1;%
7556 SlateGray2,.725,.828,.932;%
7557 SlateGray3,.624,.712,.804;%
7558 SlateGray4,.424,.484,.545;%
7559 Snow1,1,.98,.98;%
7560 Snow2,.932,.912,.912;%
7561 Snow3,.804,.79,.79;%
7562 Snow4,.545,.536,.536;%
7563 SpringGreen1,0,1,.498;%
7564 SpringGreen2,0,.932,.464;%
7565 SpringGreen3,0,.804,.4;%
7566 SpringGreen4,0,.545,.27;%
7567 SteelBlue1,.39,.72,1;%
7568 SteelBlue2,.36,.675,.932;%
7569 SteelBlue3,.31,.58,.804;%
7570 SteelBlue4,.21,.392,.545;%
7571 Tan1,1,.648,.31;%
7572 Tan2,.932,.604,.288;%
7573 Tan3,.804,.52,.248;%
7574 Tan4,.545,.352,.17;%
7575 Thistle1,1,.884,1;%
7576 Thistle2,.932,.824,.932;%
7577 Thistle3,.804,.71,.804;%
7578 Thistle4,.545,.484,.545;%
7579 Tomato1,1,.39,.28;%
7580 Tomato2,.932,.36,.26;%
7581 Tomato3,.804,.31,.224;%
7582 Tomato4,.545,.21,.15;%
7583 Turquoise1,0,.96,1;%
7584 Turquoise2,0,.898,.932;%
7585 Turquoise3,0,.772,.804;%
7586 Turquoise4,0,.525,.545;%
7587 VioletRed1,1,.244,.59;%
7588 VioletRed2,.932,.228,.55;%
7589 VioletRed3,.804,.196,.47;%
7590 VioletRed4,.545,.132,.32;%
7591 Wheat1,1,.905,.73;%
7592 Wheat2,.932,.848,.684;%
7593 Wheat3,.804,.73,.59;%
7594 Wheat4,.545,.494,.4;%
7595 Yellow1,1,1,0;%
7596 Yellow2,.932,.932,0;%
7597 Yellow3,.804,.804,0;%
7598 Yellow4,.545,.545,0;%
7599 Gray0,.745,.745,.745;%
7600 Green0,0,1,0;%
7601 Grey0,.745,.745,.745;%
7602 Maroon0,.69,.19,.376;%
7603 Purple0,.628,.125,.94}
7604 %</x11names>
7605 %
7606 %<*test1>
7607 \documentclass[a4paper]{article}
7608
7609 \usepackage{array,multicol,multido,textcomp}
7610 \usepackage{xcolor}[2005/03/24]
7611 \usepackage[hmargin={1.25cm,.75cm},vmargin=1.25cm,footskip=.5cm,nohead]{geometry}
7612
7613 \newdimen\Argwd
7614 \newdimen\Errsum
7615 \newdimen\Errmax
7616 \newcount\Colors
7617 \newcount\Errors
7618 \newcount\Loops
7619 \newif\ifColor
7620
7621 \makeatletter
7622
7623 \def\DisplayColor#1#2#3%
7624 {\global\advance\Loops\@ne
7625 \@tempdima=#1\p@ \edef\@tempa{\the\@tempdima}%
7626 \edef\Colori{\strip@pt\@tempdima}%
7627 \ifColor
7628 \@tempdimb=#2\p@ \edef\@tempb{\the\@tempdimb}%
7629 \@tempdimc=#3\p@ \edef\@tempc{\the\@tempdimc}%
7630 \edef\Colori{\Colori,\strip@pt\@tempdimb,\strip@pt\@tempdimc}%
7631 \fi
7632 \Make12\Make23\Make34\Make45\Make56\Make67%
7633 \begin{tabular}{@{}ll*4{@{ }p{\Argwd}}@{}}
7634 \Row1\Row2\Row3\Row4\Row5\Row6\noalign{\medskip}
7635 \end{tabular}
7636 \global\advance\Colors1 \relax\ifnum\Colors=30 \newpage\global\Colors=0 \fi}
7637
7638 \def\Make#1#2%
7639 {\edef\@@tmp
7640 {\noexpand\definecolor{Color\romannumeral#1}%
7641 {\@nameuse{Model\romannumeral#1}}{\@nameuse{Color\romannumeral#1}}%
7642 }\@@tmp
7643 \relax\ifnum#1<6
7644 \convertcolorspec
7645 {\@nameuse{Model\romannumeral#1}}{\@nameuse{Color\romannumeral#1}}%
7646 {\@nameuse{Model\romannumeral#2}}\@@tmp
7647 \XC@let@cN{Color\romannumeral#2}\@@tmp
7648 \fi}
7649 \def\Row#1%
7650 {\edef\@@tmp{\@nameuse{Color\romannumeral#1}\@nameuse{Row\romannumeral#1}}%
7651 \expandafter\@Row\@@tmp}
7652
7653 \def\@Row#1,#2,#3,#4,#5#6%
7654 {\fcolorbox{black}{Color\romannumeral#5}{\phantom{000}}&
7655 \csname Model\romannumeral#5\endcsname &
7656 \ifodd#6 \@Error{#1}\@tempa \else #1\fi &
7657 \ifColor\ifodd#6 \@Error{#2}\@tempb \else #2\fi\else #2\fi &
7658 \ifColor\ifodd#6 \@Error{#3}\@tempc \else #3\fi\else #3\fi &
7659 #4\\}
7660
7661 \def\defModel#1#2#3#4% number, name, commas, check
7662 {\@namedef{Model\romannumeral#1}{#2}\@namedef{Row\romannumeral#1}{#3#1#4}}
7663
7664 \def\@Error#1#2%
7665 {\ifdim#1\p@=#2\relax #1\else
7666 \textcolor{red}{#1}\global\advance\Errors\@ne
7667 \dimen@#2\advance\dimen@-#1\p@ \ifdim\dimen@<\z@\dimen@-\dimen@\fi
7668 \global\advance\Errsum\dimen@
7669 \ifdim\dimen@>\Errmax \global\Errmax\dimen@
7670 \dimen@\@tempa \edef\@@tempa{\strip@pt\dimen@}%
7671 \ifColor
7672 \dimen@\@tempb \edef\@@tempb{\strip@pt\dimen@}%
7673 \dimen@\@tempc \edef\@@tempc{\strip@pt\dimen@}%
7674 \xdef\Errcase{\@@tempa\noexpand~\@@tempb\noexpand~\@@tempc}%
7675 \else
7676 \xdef\Errcase{\@@tempa}%
7677 \fi
7678 \fi
7679 \fi}
7680
7681 \newenvironment{ColorTest}[1]%
7682 {\addcontentsline{toc}{section}{Color conversion chain: #1}
7683 \Colors\z@ \Errors\z@ \Loops\z@ \Errsum\z@ \Errmax\z@
7684 \begin{multicols}{3}\centering}%
7685 {\end{multicols}\bigskip
7686 \begin{tabular}{@{}l@{ = }l@{}}
7687 \multicolumn2{@{}l@{}}{Rounding error statistics of color conversion test}\\
7688 \multicolumn2{@{}l@{}}%
7689 {$\textbf\Modeli\rightarrow \textbf\Modelii\rightarrow \textbf\Modeliii\rightarrow
7690 \textbf\Modeliv\rightarrow \textbf\Modelv\rightarrow \textbf\Modelvi$:}\\[1ex]
7691 number of examples& \number\Loops\\
7692 number of errors& \number\Errors\\
7693 sum of absolute errors& \strip@pt\Errsum\\
7694 \ifnum\Errors>\z@
7695 average error& \Errsum100\Errsum \dimen@\Errors\p@ \divide\dimen@\@m
7696 \rdivide\Errsum\dimen@ \strip@pt\Errsum\textperiodcentered10\textsuperscript{-5}\\
7697 maximum error& \strip@pt\Errmax{} @ \Modeli~\Errcase\\
7698 \fi
7699 \end{tabular}\newpage}
7700
7701 \def\thepage{\sffamily\footnotesize\@nameuse{@arabic}\c@page}
7702
7703 \makeatother
7704
7705 \parindent0pt
7706 \setcounter{secnumdepth}{-1}
7707
7708 \begin{document}
7709
7710 \title{Color conversion with the \textsf{xcolor} package --- Examples}
7711 \author{Dr. Uwe Kern\thanks{This file is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors (\texttt{macros/latex/contrib/xcolor/}) or the homepage \texttt{www.ukern.de/tex/xcolor.html}. Please send error reports and suggestions for improvements to \texttt{https://github.com/latex3/xcolor/issues}.}}
7712 \date{\XCfileversion{} (\XCfiledate)}
7713 \maketitle
7714
7715 \begin{center}
7716 \begin{minipage}{.75\textwidth}
7717 \tableofcontents
7718 \end{minipage}
7719 \end{center}
7720 \newpage
7721
7722 \sffamily\footnotesize
7723 \fboxrule.25pt
7724 \settowidth\Argwd{0.00000}
7725
7726 \defModel1{rgb}{,,}0
7727 \defModel2{cmy}{,,}0
7728 \defModel3{cmyk}{,}0
7729 \defModel4{hsb}{,,}0
7730 \defModel5{rgb}{,,}1
7731 \defModel6{gray}{,,,,}0
7732 \Colortrue
7733
7734 \begin{ColorTest}{rgb, cmy, cmyk, hsb, rgb, gray}
7735 \multido{\nR=1+-.1}{11}%
7736 {\multido{\nG=1+-.1}{11}%
7737 {\multido{\nB=1+-.1}{11}%
7738 {\DisplayColor{\nR}{\nG}{\nB}}}}%
7739 \end{ColorTest}
7740
7741 \defModel1{gray}{,,,,}0
7742 \defModel2{rgb}{,,}0
7743 \defModel3{cmy}{,,}0
7744 \defModel4{cmyk}{,}0
7745 \defModel5{hsb}{,,}0
7746 \defModel6{gray}{,,,,}1
7747 \Colorfalse
7748
7749 \begin{ColorTest}{gray, rgb, cmy, cmyk, hsb, gray}
7750 \multido{\nG=1+-.01}{101}{\DisplayColor{\nG}{}{}}%
7751 \end{ColorTest}
7752
7753 \end{document}
7754 %</test1>
7755 %
7756 %<*test2>
7757 \listfiles
7758 \documentclass{article}
7759
7760 \usepackage{pstricks,pst-tree,pst-slpe,multido}
7761 \makeatletter
7762 \makeatother
7763 \usepackage{fancyvrb-ex}
7764
7765 \def\textfraction{0.01}
7766 \def\topfraction{0.99}
7767 \def\bottomfraction{0.99}
7768 \def\floatpagefraction{0.70}
7769 \setlength\abovecaptionskip{12pt}
7770 \setlength\belowcaptionskip{10pt}
7771 \parindent0pt
7772
7773 \begin{document}
7774 \title{Color extensions with the \textsf{xcolor} package --- \textsf{pstricks} examples}
7775 \author{Dr. Uwe Kern\thanks{This file is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors (\texttt{macros/latex/contrib/xcolor/}) or the homepage \texttt{www.ukern.de/tex/xcolor.html}. Please send error reports and suggestions for improvements to \texttt{https://github.com/latex3/xcolor/issues}.}}
7776 \date{\XCfileversion{} (\XCfiledate)}
7777 \maketitle
7778
7779 \centerline{\fcolorbox{red}{yellow!50}{This document is not suitable for pdf\LaTeX! Please use \LaTeX{} + \texttt{dvips} etc.}}
7780
7781 \begin{figure}[htb]\caption{Modified version of an example from the \textsf{pstricks} manual; requires \textsf{pst-tree}}
7782 \begin{SideBySideExample}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
7783 \begin{pspicture}(-0.5,-2)(3,2)
7784 \cnode(0,0){.5cm}{root}
7785 \cnode*[linecolor=red](3,1.5){4pt}{A}
7786 \cnode*[linecolor=red!72.5375!blue](3,0){4pt}{B}
7787 \cnode*[linecolor=-red](3,-1.5){4pt}{C}
7788 \psset{nodesep=3pt}
7789 \ncline[linecolor=green!50!red]{root}{A}
7790 \ncline[linecolor=blue]{root}{B}
7791 \ncline[linecolor=-green!50!red]{root}{C}
7792 \end{pspicture}
7793 \end{SideBySideExample}
7794 \end{figure}
7795
7796 \begin{figure}[htb]\caption{Moving from one color to its complement; requires \textsf{pst-slpe}}
7797 \begin{SideBySideExample}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
7798 \begin{pspicture}(4,1)
7799 \psframe[fillstyle=slope,
7800 slopeangle=30,
7801 slopebegin=red!72.5375!blue,
7802 slopeend=-red!72.5375!blue](4,1)
7803 \end{pspicture}
7804 \end{SideBySideExample}
7805 \end{figure}
7806
7807 \begin{figure}[htb]\caption{Explicit color specification via a loop command; requires \textsf{multido}}
7808 \begin{SideBySideExample}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
7809 \psset{unit=1.75}%
7810 \begin{pspicture}(0,-1)(2,1)
7811 \multido{\rHue=0.00+0.01}{100}%
7812 {\pscircle[linewidth=0.01,
7813 linecolor={[hsb]{\rHue,1,1}}](1,0){\rHue}}
7814 \end{pspicture}
7815 \end{SideBySideExample}
7816 \end{figure}
7817
7818 \begin{figure}[htb]\caption{Color series --- modified version of an example from the \textsf{pst-fill} manual; note that the \texttt{\string\multirput} command does not give the desired result here}
7819 \begin{SideBySideExample}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
7820 \newcommand*\Sheep
7821 {\begin{pspicture}(3,1.5)
7822 \pscustom[liftpen=2,fillstyle=solid,fillcolor=sheep!!+]%
7823 {\pscurve(0.5,-0.2)(0.6,0.5)(0.2,1.3)(0,1.5)(0,1.5)
7824 (0.4,1.3)(0.8,1.5)(2.2,1.9)(3,1.5)(3,1.5)(3.2,1.3)
7825 (3.6,0.5)(3.4,-0.3)(3,0)(2.2,0.4)(0.5,-0.2)}
7826 \pscircle*(2.65,1.25){0.12\psunit}% Eye
7827 \psccurve*(3.5,0.3)(3.35,0.45)(3.5,0.6)(3.6,0.4)% Muzzle
7828 \pscurve(3,0.35)(3.3,0.1)(3.6,0.05)% Mouth
7829 \pscurve(2.3,1.3)(2.1,1.5)(2.15,1.7)
7830 \pscurve(2.1,1.7)(2.35,1.6)(2.45,1.4)% Ear
7831 \end{pspicture}}
7832 \definecolorseries
7833 {sheep}{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}
7834 \resetcolorseries{sheep}
7835 \psset{unit=0.4}
7836 \begin{pspicture}(-3,-6)(0,7.5)
7837 \Multido{\ry=6.0+-1.5}{5}%
7838 {\rput(0,\ry){\Multido{}{5}{\Sheep}}}
7839 \resetcolorseries{sheep}%
7840 \multirput(-6,-6)(3,0)5{\Sheep}
7841 \end{pspicture}
7842 \end{SideBySideExample}
7843 \end{figure}
7844
7845 \begin{figure}[htb]\caption{Interaction with native PostScript code --- $\gamma$-corrected wavelengths}
7846 \begin{Example}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
7847 \newcount\WL \unitlength.75pt
7848 \def\WaveToPS#1%
7849 {\definecolor{tmp}{rgb:wave}{#1}\extractcolorspecs{tmp}\tmpm\tmpc
7850 \expandafter\WaveToPSi\tmpc,}
7851 \def\WaveToPSi#1,#2,#3,{\pstVerb{/Red{#1}def /Green{#2}def /Blue{#3}def}}
7852 \def\DisplayBar#1#2%
7853 {\linethickness{1.25\unitlength}\WL=360
7854 \pstVerb{/Gamma{#1}def}%
7855 \multiput(360,#2)(1,0){456}%
7856 {\WaveToPS{\the\WL}{\color{lambda}\line(0,1){50}}\global\advance\WL1}%
7857 \linethickness{0.25\unitlength}\WL=360
7858 \multiput(360,#2)(20,0){23}%
7859 {\picture(0,0)
7860 \line(0,-1){5}\multiput(5,0)(5,0){3}{\line(0,-1){2.5}}%
7861 \put(0,-10){\makebox(0,0){\the\WL}}\global\advance\WL20
7862 \endpicture}%
7863 \put(350,#2){\makebox(0,50)[r]{\small$\gamma$\,=\,#1}}}
7864 \pstVerb{/Corr{dup 0 gt {Gamma exp}if}def}
7865 \definecolor[ps]{lambda}{rgb}{Red Corr Green Corr Blue Corr}%
7866 \begin{picture}(510,345)(310,-10)
7867 \sffamily\tiny
7868 \DisplayBar{0.4}{0}%
7869 \DisplayBar{0.6}{70}%
7870 \DisplayBar{0.8}{140}%
7871 \DisplayBar{1.0}{210}%
7872 \DisplayBar{1.2}{280}%
7873 \end{picture}
7874 \end{Example}
7875 \end{figure}
7876
7877 \end{document}
7878 %</test2>
7879 %
7880 %<*test3>
7881 \listfiles
7882 \documentclass[a4paper]{article}
7883 \usepackage[showerrors,table,dvipsnames*,hyperref]{xcolor}[2005/12/21]
7884 \usepackage[margin=2.25cm]{geometry}
7885 \usepackage
7886 [\GinDriver,hyperindex=false,bookmarks,bookmarksopen,bookmarksopenlevel=1,%
7887 pdftitle={xcolor3 \XCfileversion{} (\XCfiledate)},pdfauthor={Dr. Uwe Kern},%
7888 pdfsubject={Color extensions for LaTeX and pdfLaTeX},%
7889 pdfkeywords={xcolor,color,colour,model,tint,tone,shade,harmony,spot,latex,pdftex,dvips,%
7890 conversion,blend,mix,mask,separation,rgb,cmy,cmyk,hsb,gray,html,wave,thsb,wheel}]{hyperref}
7891
7892 \tracingcolors=4
7893 %%\tracingcolors=3
7894 %%\tracingcolors=2
7895 %%\tracingcolors=1
7896 %%\tracingcolors=0
7897
7898 \parindent0pt
7899 \pagecolor{gray!25}
7900
7901 \definecolors{JungleGreen,DarkOrchid}
7902
7903 \begin{document}
7904 \title{Color extensions with the \textsf{xcolor} package --- various examples}
7905 \author{\href{mailto:[email protected]}{\fboxrule0pt\fboxsep2pt\fbox{Dr. Uwe Kern}}}
7906 \date{\XCfileversion{} (\XCfiledate)
7907 \thanks{This file (\texttt{\jobname.tex}) is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors \texttt{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/xcolor/}{CTAN/macros/latex/contrib/xcolor/}} or the homepage \texttt{\href{http://www.ukern.de/tex/xcolor.html}{www.ukern.de/tex/xcolor.html}}. Please send error reports and suggestions for improvements to \url{https://github.com/latex3/xcolor/issues}.}}
7908 \maketitle
7909
7910 The purpose of this file is to demonstrate a variety of capabilities including the logging facilities of the \textsf{xcolor} package.
7911 By playing around with different values of \texttt{\string\tracingcolors}, one can observe the different behavior in the \texttt{log} file.
7912
7913 \section{Predefined colors}
7914
7915 \begingroup
7916 \small\sffamily
7917 \rowcolors1{}{}
7918 \begin{testcolors}[rgb,cmyk,hsb,HTML,gray]
7919 \testcolor{red}
7920 \testcolor{green}
7921 \testcolor{blue}
7922 \testcolor{cyan}
7923 \testcolor{magenta}
7924 \testcolor{yellow}
7925 \testcolor{orange}
7926 \testcolor{violet}
7927 \testcolor{purple}
7928 \testcolor{brown}
7929 \testcolor{pink}
7930 \testcolor{olive}
7931 \testcolor{black}
7932 \testcolor{darkgray}
7933 \testcolor{gray}
7934 \testcolor{lightgray}
7935 \testcolor{white}
7936 \noalign{\medskip}\hline\noalign{\medskip}
7937 \testcolor{-red}
7938 \testcolor{-green}
7939 \testcolor{-blue}
7940 \testcolor{-cyan}
7941 \testcolor{-magenta}
7942 \testcolor{-yellow}
7943 \testcolor{-orange}
7944 \testcolor{-violet}
7945 \testcolor{-purple}
7946 \testcolor{-brown}
7947 \testcolor{-pink}
7948 \testcolor{-olive}
7949 \testcolor{-black}
7950 \testcolor{-darkgray}
7951 \testcolor{-gray}
7952 \testcolor{-lightgray}
7953 \testcolor{-white}
7954 \noalign{\medskip}\hline\noalign{\medskip}
7955 \testcolor{JungleGreen}
7956 \testcolor{DarkOrchid}
7957 \noalign{\medskip}\hline\noalign{\medskip}
7958 \testcolor{-JungleGreen}
7959 \testcolor{-DarkOrchid}
7960 \end{testcolors}
7961 \endgroup
7962
7963 \vfill
7964
7965 \clearpage
7966 \nopagecolor
7967 Switch off \texttt{\string\pagecolor} by \texttt{\string\nopagecolor}.
7968 The driver may or may not obey this command \dots
7969
7970 \clearpage
7971 \pagecolor{white}
7972
7973 \section{Color definition and application}
7974
7975 \providecolor{dummy}{rgb}{.6,.5,.4}
7976 \definecolor{dummy}{rgb}{.6,.5,.4}
7977 \providecolor{dummy}{rgb}{.6,.5,.4}
7978 \hbox{\textcolor{dummy}{Test with \texttt{\string\definecolor}}}
7979
7980 \bigskip
7981
7982 Comma-separated and space-separated definitions:
7983
7984 \definecolor{c1}{rgb}{.7,.6,.5}
7985 \definecolor{c2}{rgb}{.7 .6 .5}
7986 \colorlet{c1a}{c1}
7987 \colorlet{c2a}{c2}
7988
7989 \textcolor{c1}{identical} =
7990 \textcolor{c2}{identical} =
7991 \textcolor{c1a}{identical} =
7992 \textcolor{c2a}{identical} =
7993 \textcolor[rgb]{.7,.6,.5}{identical} =
7994 \textcolor[rgb]{.7 .6 .5}{identical} =
7995 \textcolor{rgb,10:red,7;green,6;blue,5}{identical}
7996 \textcolor{rgb,15:red,10.5;green,9;blue,7.5}{identical}
7997
7998 \medskip
7999
8000 \begingroup
8001 \sffamily
8002 \begin{testcolors}
8003 \testcolor{c1}
8004 \testcolor{c2}
8005 \testcolor{c1a}
8006 \testcolor{c2a}
8007 \testcolor[rgb]{.7,.6,.5}
8008 \testcolor[rgb]{.7 .6 .5}
8009 \testcolor{rgb,10:red,7;green,6;blue,5}
8010 \testcolor{rgb,15:red,10.5;green,9;blue,7.5}
8011 \end{testcolors}
8012 \endgroup
8013
8014 \bigskip
8015
8016 \textcolor{rgb:red!50,4;green!25,2}{Another extended color expression (rgb:red!50,4;green!25,2)}.
8017
8018 \bigskip
8019
8020 \begingroup
8021 \color{black}
8022 Test with named colors:\par
8023 \color{blue}
8024 Test: \textcolor[named]{JungleGreen}{JungleGreen};
8025 Test: \textcolor{JungleGreen}{JungleGreen};
8026 Test: \textcolor{JungleGreen!50!DarkOrchid}{JungleGreen!50!DarkOrchid};
8027 Test: \textcolor{green!50!red}{green!50!red}.
8028 \endgroup
8029
8030 \bigskip
8031
8032 {\color[rgb]{.4,.5,.6}Test with \texttt{\string\color}}
8033
8034 \bigskip
8035 Current color application:\par
8036 \def\test{current, \textcolor{.!50}{50\%}, \textcolor{-.}{complement},
8037 \textcolor{yellow!50!.}{mix}}
8038 \textcolor{blue}{\test} and \textcolor{red}{\test},\par
8039 \def\Test{\color{.!80}Test}
8040 \textcolor{blue}{\Test\Test\Test\Test\Test} and
8041 \textcolor{red}{\Test\Test\Test\Test\Test}.
8042
8043 \bigskip
8044 Current color test with \texttt{\string\definecolorseries}:\par
8045 \begingroup
8046 \color{blue}
8047 \definecolorseries{foo}{rgb}{last}{.}{-.}
8048 \resetcolorseries[5]{foo}
8049 \def\test{\hbox to 1em{{\color{foo!!+}\vrule width 1em height 1.5ex}}}
8050 Test\test\test\test\test\test\test Test
8051
8052 \resetcolorseries[5]{foo}
8053 \def\test{\hbox to 1em{{\color{foo!!++}\vrule width 1em height 1.5ex}}}
8054 Test\test\test\test\test\test\test Test
8055
8056 \resetcolorseries[5]{foo}
8057 \def\test{\hbox to 1em{{\color{foo!![2]}\vrule width 1em height 1.5ex}}}
8058 Test\test\test\test\test\test\test Test
8059
8060 \endgroup
8061
8062 \section{Color in tables}
8063
8064 \rowcolors[\hline]{1}{green!25}{yellow!50}
8065 \begin{tabular}{ll}
8066 test & row \number\rownum\\
8067 test & row \number\rownum\\
8068 \rowcolor{blue!25}
8069 test & row \number\rownum\\
8070 test & row \number\rownum\\
8071 \hiderowcolors
8072 test & row \number\rownum\\
8073 test & row \number\rownum\\
8074 \showrowcolors
8075 test & row \number\rownum\\
8076 test & row \number\rownum\\
8077 \multicolumn{1}%
8078 {>{\columncolor{red!12}}l}{test} & row \number\rownum\\
8079 \end{tabular}
8080
8081 \section{Color information}
8082
8083 Type test:
8084 \makeatletter
8085 \@namedef{\string\color@foo1}{foo1{}{}{}{}}\edef\tempa{\XC@type{foo1}}\tempa
8086 \@namedef{\string\color@foo2}{\xcolor@{foo2}{}{}{}}\edef\tempb{\XC@type{foo2}}\tempb
8087 \@namedef{\string\color@foo3}{\xcolor@{}{foo3}{}{}}\edef\tempc{\XC@type{foo3}}\tempc
8088 \@namedef{\string\color@foo4}{\xcolor@{}{}{foo4}{}}\edef\tempd{\XC@type{foo4}}\tempd
8089 \makeatother
8090
8091 \end{document}
8092 %</test3>
8093 %
8094 %<*test4>
8095 \listfiles
8096 \documentclass[a4paper]{article}
8097 %%\PassOptionsToPackage{dvipdf}{xcolor}
8098 %%\PassOptionsToPackage{dvipdfm}{xcolor}
8099 %%\PassOptionsToPackage{dvipdfmx}{xcolor}
8100 %%\PassOptionsToPackage{dvips}{xcolor}
8101 %%\PassOptionsToPackage{dvipsone}{xcolor}
8102 %%\PassOptionsToPackage{dviwin}{xcolor}
8103 %%\PassOptionsToPackage{dviwindo}{xcolor}
8104 %%\PassOptionsToPackage{emtex}{xcolor}
8105 %%\PassOptionsToPackage{oztex}{xcolor}
8106 %%\PassOptionsToPackage{luatex}{xcolor}
8107 %%\PassOptionsToPackage{pctex32}{xcolor}
8108 %%\PassOptionsToPackage{pctexhp}{xcolor}
8109 %%\PassOptionsToPackage{pctexps}{xcolor}
8110 %%\PassOptionsToPackage{pctexwin}{xcolor}
8111 %%\PassOptionsToPackage{pdftex}{xcolor}
8112 %%\PassOptionsToPackage{tcidvi}{xcolor}
8113 %%\PassOptionsToPackage{textures}{xcolor}
8114 %%\PassOptionsToPackage{truetex}{xcolor}
8115 %%\PassOptionsToPackage{vtex}{xcolor}
8116 %%\PassOptionsToPackage{xdvi}{xcolor}
8117 %%\PassOptionsToPackage{xetex}{xcolor}
8118 %%\PassOptionsToPackage{prologue}{xcolor}
8119 %%\PassOptionsToPackage{kernelfbox}{xcolor}
8120 %%\PassOptionsToPackage{xcdraw}{xcolor}
8121 \usepackage[emtex]{graphics}
8122 \usepackage{xcolor}
8123 \usepackage[margin=1.25cm,noheadfoot]{geometry}
8124 \pagestyle{empty}
8125 \parindent0pt
8126 \nofiles
8127 \let\familydefault\sfdefault
8128 \makeatletter
8129 %% special code for driver list construction via
8130 %% latex \def\xcdriverlist{1}\input{xcolor4}
8131 %% writes list in file xcolor4.tmp
8132 \@ifundefined{xcdriverlist}{}{%
8133 %% optional * (skips test whether #1.def exists)
8134 %% #1 = driver
8135 %% #2 = additional options (stored in \options@#2)
8136 %% #3 = processor 1
8137 %% #4 = output format 1
8138 %% #5 = processor 2
8139 %% #6 = output format 2
8140 %% #7 = processor 3
8141 %% #8 = output format 3
8142 \def\0{\@ifstar
8143 {\def\@@tmp####1{\@firstoftwo}\1}{\def\@@tmp####1{\IfFileExists{####1.def}}\1}}
8144 \def\1#1#2#3#4#5#6#7#8{\@@tmp{#1}%
8145 {\XC@let@Nc\@@tmp{options@#2}
8146 \ifx\@@tmp\@empty\else
8147 \edef\@@tmp{,\@@tmp}\XC@replace\@@tmp,{;#1-}\XC@replace\@@tmp;,
8148 \fi
8149 \edef\@@tmp{:=#1\@@tmp}
8150 \expandafter\@for\expandafter\@tempa\@@tmp\do
8151 {\let\@@tmp\@tempa\XC@replace\@@tmp-,
8152 \edef\@@tmp{\@tempa\space\string\PassOptionsToPackage{\@@tmp}{xcolor}}
8153 \@namexdef{list@#4}{\@nameuse{list@#4},#3 \@@tmp}
8154 \@namexdef{list@#6}{\@nameuse{list@#6},#5 \@@tmp}
8155 \@namexdef{list@#8}{\@nameuse{list@#8},#7 \@@tmp}}}%
8156 {\typeout{No file `#1.def' found.}}}
8157 \def\list@{}
8158 \def\list@dvi{}
8159 \def\list@ps{}
8160 \def\list@pdf{}
8161 \@namedef{options@0}{}
8162 \@namedef{options@1}{kernelfbox,prologue,xcdraw,kernelfbox-xcdraw,prologue-xcdraw}
8163 \0{dvips}1{latex}{dvi}{dvips}{ps}{ps2pdf}{pdf}
8164 \0{pctex32}0{latex}{dvi}{dvips}{ps}{ps2pdf}{pdf}
8165 \0{dvipdf}0{latex}{dvi}{dvipdf}{pdf}{}{}
8166 \0{dvipdfm}1{latex}{dvi}{dvipdfm}{pdf}{}{}
8167 \0{dvipdfmx}0{latex}{dvi}{dvipdfmx}{pdf}{}{}
8168 \0{dvipsone}0{latex}{dvi}{}{}{}{}
8169 \0{dviwin}0{latex}{dvi}{}{}{}{}
8170 \0*{dviwindo}0{latex}{dvi}{}{}{}{}
8171 \0{emtex}0{latex}{dvi}{}{}{}{}
8172 \0*{oztex}0{latex}{dvi}{}{}{}{}
8173 \0{pctexhp}0{latex}{dvi}{}{}{}{}
8174 \0{pctexps}0{latex}{dvi}{}{}{}{}
8175 \0{pctexwin}0{latex}{dvi}{}{}{}{}
8176 \0{tcidvi}0{latex}{dvi}{}{}{}{}
8177 \0{textures}0{latex}{dvi}{}{}{}{}
8178 \0{truetex}0{latex}{dvi}{}{}{}{}
8179 \0*{xdvi}0{latex}{dvi}{}{}{}{}
8180 \0{pdftex}1{pdflatex}{pdf}{}{}{}{}
8181 \0{vtex}0{vlatex}{pdf}{}{}{}{}
8182 \0{xetex}0{xelatex}{pdf}{}{}{}{}
8183 \newwrite\@tempa\immediate\openout\@tempa=\jobname.tmp
8184 \@tfor\@tempb:={dvi}{ps}{pdf}\do
8185 {\edef\@@tmp{\@nameuse{list@\@tempb}}\edef\@@tmp{:=\expandafter\@gobble\@@tmp}
8186 \expandafter\@for\expandafter\@@tmp\@@tmp\do
8187 {\immediate\write\@tempa{\@@tmp}}}
8188 \immediate\closeout\@tempa
8189 \@@end}% end of driver list construction code
8190 \edef\Options{}
8191 \@tfor\@@tmp:={dvipdf}{dvipdfm}{dvipdfmx}{dvips}{dvipsone}{dviwin}{dviwindo}%
8192 {emtex}{oztex}{pctex32}{pctexhp}{pctexps}{pctexwin}{pdftex}%
8193 {tcidvi}{textures}{truetex}{vtex}{xdvi}{xetex}%
8194 {natural}{table}{fixpdftex}{hyperref}{showerrors}{hideerrors}%
8195 {override}{usenames}{nodvipsnames}{debugshow}\do
8196 {\expandafter\XC@replace\expandafter\Options\expandafter{\@@tmp,}{}}
8197 \edef\Options{\XC@@drv,\Options}
8198 \def\@@tmp#1,#2%
8199 {\ifx,#2#1\expandafter\remove@to@nnil\else#1', `\expandafter\@@tmp\fi#2}
8200 \edef\Options{`\expandafter\@@tmp\Options,,\@nnil'}
8201 \makeatother
8202 \begin{document}
8203 \vbox to\textheight{\vss\centering
8204 {\Large\textbf{xcolor} driver test: \Options}
8205 \vskip0.5cm
8206 \begin{testcolors}[rgb,hsb,cmyk,gray,HTML]
8207 \testcolor{magenta}
8208 \testcolor[rgb]{1,0,1}
8209 \testcolor[hsb]{0.83333,1,1}
8210 \testcolor[cmyk]{0,1,0,0}
8211 \testcolor[gray]{0.41}
8212 \noalign{\medskip}
8213 \testcolor{blue}
8214 \testcolor[rgb]{0,0,1}
8215 \testcolor[hsb]{0.66667,1,1}
8216 \testcolor[cmyk]{1,1,0,0}
8217 \testcolor[gray]{0.11}
8218 \noalign{\medskip}
8219 \testcolor{cyan}
8220 \testcolor[rgb]{0,1,1}
8221 \testcolor[hsb]{0.5,1,1}
8222 \testcolor[cmyk]{1,0,0,0}
8223 \testcolor[gray]{0.7}
8224 \noalign{\medskip}
8225 \testcolor{green}
8226 \testcolor[rgb]{0,1,0}
8227 \testcolor[hsb]{0.33333,1,1}
8228 \testcolor[cmyk]{1,0,1,0}
8229 \testcolor[gray]{0.59}
8230 \noalign{\medskip}
8231 \testcolor{yellow}
8232 \testcolor[rgb]{1,1,0}
8233 \testcolor[hsb]{0.16667,1,1}
8234 \testcolor[cmyk]{0,0,1,0}
8235 \testcolor[gray]{0.89}
8236 \noalign{\medskip}
8237 \testcolor{red}
8238 \testcolor[rgb]{1,0,0}
8239 \testcolor[hsb]{0,1,1}
8240 \testcolor[cmyk]{0,1,1,0}
8241 \testcolor[gray]{0.3}
8242 \noalign{\medskip}
8243 \testcolor{black}
8244 \testcolor[rgb]{0,0,0}
8245 \testcolor[hsb]{0,0,0}
8246 \testcolor[cmyk]{0,0,0,1}
8247 \testcolor[gray]{0}
8248 \noalign{\medskip}
8249 \testcolor{gray}
8250 \testcolor[rgb]{0.5,0.5,0.5}
8251 \testcolor[hsb]{0,0,0.5}
8252 \testcolor[cmyk]{0,0,0,0.5}
8253 \testcolor[gray]{0.5}
8254 \noalign{\medskip}
8255 \testcolor{white}
8256 \testcolor[rgb]{1,1,1}
8257 \testcolor[hsb]{0,0,1}
8258 \testcolor[cmyk]{0,0,0,0}
8259 \testcolor[gray]{1}
8260 \noalign{\medskip\smallskip}
8261 f(color)box &
8262 \multicolumn5{c}{\def\i{\fbox{\a}}\def\ii{\fcolorbox{red}{yellow}{\a}}\def\iii{\scalebox{3}}%
8263 \def\a{{\setbox0=\hbox to3ex{\hss\textcolor{blue}{\vrule width .75ex height1.5ex depth1.5ex}\hss}\ht0=0pt\dp0=0pt\box0}}%
8264 \fboxsep0.333ex \i\quad\ii\quad\iii\i\quad\iii\ii\quad\fboxrule.75ex \iii\i\quad\iii\ii}
8265 \end{testcolors}
8266 \vskip0.5cm
8267 {\footnotesize This table was generated with \textbf{xcolor4.tex} which is part of the \textbf{xcolor} package \XCfileversion{} (\XCfiledate) by Uwe Kern.}
8268 \vss}
8269 \end{document}
8270 %</test4>
8271 %
8272 % \fi
8273 \endinput
8274 %%
8275 %% End of file `xcolor.dtx'.