%%% Colors %%%
+% Use of pdfTeX color stack:
+% \colorpush\rgb{1 0 0} puts a new color on the stack
+% \colorset\rgb{1 0 0} replaces the top color on the stack
+% \colorpop pops the top color
+% \colorlocal\rgb{1 0 0} set a color locally until the end of the current group
\chardef\colorstk=\pdfcolorstackinit page direct{0 g 0 G}
-\def\colorpush#1{\pdfcolorstack\colorstk push{#1 rg #1 RG}}
-\def\colorpushgray#1{\pdfcolorstack\colorstk push{#1 g #1 G}}
-\def\colorpushcmyk#1{\pdfcolorstack\colorstk push{#1 k #1 K}}
+\def\colorset#1{\pdfcolorstack\colorstk set #1}
+\def\colorpush#1{\pdfcolorstack\colorstk push #1}
\def\colorpop{\pdfcolorstack\colorstk pop}
+\def\colorlocal{\aftergroup\colorpop\colorpush}
+
+% Different ways of describing colors: \rgb{R G B}, \gray{G}, \cmyk{C M Y K}
+% (all components are real numbers between 0 and 1)
+\def\rgb#1{{#1 rg #1 RG}}
+\def\gray#1{{#1 g #1 G}}
+\def\cmyk#1{{#1 k #1 K}}
%%% Localization %%%