[Tex/LaTex] How to save the current colour

color

If I want to gray out large swaths of text in a report, I know that I can use the xcolor package's \color{black!50} command:
How to change color for a block of texts?
http://alvinalexander.com/blog/post/latex/use-font-colors-in-latex-documents

Is there any way to confirm that the default color is indeed black before I issue the above command?

In a related search, I found that I can even push the current colour onto a stack:
http://www.cs.stir.ac.uk/~kjt/software/latex/colours.html

However, that page is from 1997, targets slides, and uses a different package. I am currently very bound to the xcolor package.

This question has been posted at:
How to save the current colour
http://latex-community.org/forum/viewtopic.php?f=44&t=25431

Best Answer

Package xcolor has the concept of a "current color" with the dot as name. With \colorlet it can be saved:

\usepackage{xcolor}
...
\begin{document}
...
\colorlet{saved}{.}
\color{black!50}
...
\color{saved}

Or grouping can be used, which also works with LaTeX's color package:

  • small text: \textcolor{black!50}{...}

  • larger chunks including paragraphs:

    \begingroup
      \color{black!50}
      ...
    \endgroup
    

    (Also curly braces can be used for grouping.)

Related Question