## LaTeX forum ⇒ Text Formatting ⇒ How to save the current colour Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
JustA_LaTeXusr
Posts: 42
Joined: Tue Jul 23, 2013 6:48 pm

### How to save the current colour

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:
http://tex.stackexchange.com/questions/ ... k-of-texts
http://alvinalexander.com/blog/post/lat ... -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/ ... lours.html

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

This question has been posted at:
http://tex.stackexchange.com/questions/ ... ent-colour
viewtopic.php?f=44&t=25431

Tags:

Johannes_B
Site Moderator
Posts: 4183
Joined: Thu Nov 01, 2012 4:08 pm
Hi, you already got a pretty good answer by Heiko Oberdiek. I would stick to that.

To sum it up, use either groups (compatible with package color) or save the current color using the single dot:
\documentclass{article}\usepackage[x11names]{xcolor}\usepackage{blindtext}\begin{document}\blindtext\begingroup\color{Blue3} You can use groups to locally switch thecolor \blindtext\endgroup you can also save the current color, with a single dot. Just likeunix uses the single dot for the current directory.  \colorlet{colorsave}{.}\color{Brown4}\blindtext and later restore the savedcolor \color{colorsave} \blindtext\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

JustA_LaTeXusr
Posts: 42
Joined: Tue Jul 23, 2013 6:48 pm
Thanks, Johannes. Interesting example you provided, educating me on the blindtext package.

Johannes_B
Site Moderator
Posts: 4183
Joined: Thu Nov 01, 2012 4:08 pm
On the one side there are people saying this is lazyness, others called it efficiency. I think you need to be both to get the work done.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.