Invert Background and Text Colours across Whole Document with pdflatex
You can do this with the xcolor
package.
\documentclass{article}
\usepackage{xcolor}
\pagecolor[rgb]{0.5,0.5,0.5}
\color[rgb]{1,1,1}
\begin{document}
Hello \clearpage World
\end{document}
As no LaTeX solution:
- If you use evince as pdf viewer you can simply press Ctrl+I to invert any document. It will keep that setting for just that document even if you change and reload the document.
- Yo can use
xcalib -i -a
to invert a whole screen.
I recommend a more understandable way to write it using commands, based in the words of Lamport, "The LaTeX commands describe the logical structure of a Document' (See LaTeX - User's Guide and Reference Manual, Sect 2.2).
%Commands definitions
\newcommand{\setbackgroundcolour}{\pagecolor[rgb]{0.19,0.19,0.19}}
\newcommand{\settextcolour}{\color[rgb]{0.77,0.77,0.77}}
\newcommand{\invertbackgroundtext}{\setbackgroundcolour\settextcolour}
%Command execution.
%If this line is commented, then the appearance remains as usual.
\invertbackgroundtext
A bit more work, but a more readable document. Moreover, when you do not want to change the colours, you have only to comment out the command \invertbackgroundtext
Note: instead of 0.5
and 1
, I used 0.19
for background and 0.77
for text—I think these colours give a lesser eye strain.