In a previous question ( How do I globally set the text color in XeLaTeX ), I've asked how to globally set a text colour in XeLaTeX and got some excellent answers.
However, while the proposed mechanisms seem to work in most cases, they also seem to fail consistently for the colour white
. I'm not sure if this is a bug or if I'm doing something wrong here, but please consider the following example:
\documentclass{report}
\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont[Color=white]{Linux Libertine O}
\setsansfont[Color=white]{Linux Biolinum O}
\setmonofont[Color=white]{Inconsolata}
\pagecolor{darkgray}
\begin{document}
\chapter{A chapter}
\section{A section}
\texttt{Some mono text}
The text above is invisible as it is all black and not white.
{\addfontfeature{Color=yellow} Some yellow text showing up on the dark page.}
{\addfontfeature{Color=white} Some white text invisible on the dark page.}
\end{document}
The example follows @AlanMunn s suggestion on the other question. The result is:
The white text is printed in black. Other colours (like yellow in the example) work well.
If I use @Herbert s suggestion of adding
\AtBeginDocument{\color{white}}
\addtokomafont{sectioning}{\color{white}}
to the document, I keep stumbling over environments that are still black, like the captions of figures for example. In any case, the \color
command seems to be stronger than the fontspec
setting.
Any thoughts or solutions to this?
xcolor
with the[svgnames]
option and usingSnow
instead ofwhite
gives you a very close approximation.