I want to go (back) to the default text color. If the default color is black then I can use \color{black}
. But I'm looking for a command for the general case where black may or may not be the default color. Something like \color{defaultcolor}
.
(I'm aware of the advantages of using {\color{...}...}
or \textcolor
instead, but I want specifically \color{defaultcolor}
.)
Edit: I use the color
package, or probably I could use xcolor
.
Best Answer
Both
color.sty
andxcolor.sty
contain the following two lines:So at the beginning of the document (after the preamble),
\default@color
is set to\current@color
. Then\normalcolor
returns the colour to whatever it was set to in the preamble (or DeviceGray Black if nothing is set in the preamble).If neither
color
norxcolor
are loaded then\normalcolor
is defined inlatex.ltx
as\relax
, so it does nothing.MWE
This also works in
beamer
when the default text colour is set using\setbeamercolor{normal text}{fg=...}
.MWE