Situation
Let's say I have defined some colors. I'd like to produce a test page that functions as a color-key for developers.
Example
The defined colors colora
, colorb
, and colorc
should be iterated without mentioning them explicitly again (happens automatically). This is efficient programming in that I can have an arbitrary number of colors (perhaps 50 or so) and create a time-saving color key.
\documentclass{article}
\usepackage{fontspec}
\usepackage{tikz}
\usepackage{pgffor}
\definecolor{colora}{cmyk}{0,.5,1,.3}
\definecolor{colorb}{cmyk}{.4,.6,.5,.1}
\definecolor{colorc}{cmyk}{.6,.2,.5,.2}
\begin{document}
%\foreach \definedcolor in {defined colors} % pseudo-code
% \tikz \node [fill=definedcolor, minimum width=2cm, minimum height=1cm,text=white] {name of defined color}; % pseudo-code
\color{colora} COLORA
\color{colorb} COLORB
\color{colorc} COLORC
\end{document}
blue
,red
,cyan
, etc.) be included or excluded from this loop? What if your color definitions overwrite a pre-defined color name? – Paul Gessler Mar 29 '15 at 19:32