[Tex/LaTex] Creating pdf with inverted colors using pdflatex (like white on black etc)

colorpdf

Is there a simple way of a creating PDF with inverted colours?

A partial solution would be just changing font to white and making the background black.

Is there simple "full" solution of inverting whole PDF pages? (including colors in lstlistings, images, etc)

Best Answer

You can set a pagecolor with the background package and the page color using the color command. You will need to pass the values onto setlistings as well. Color inversion of images is perhaps not possible although you can manipulate them as well. What do you exactly want the images to look like?

enter image description here

\documentclass{article}
\usepackage{graphicx}
\usepackage{listings}
\lstnewenvironment{teX}[1][]
  {\lstset{language=[LaTeX]TeX}\lstset{escapeinside={(*@}{@*)},
   numbers=left,numberstyle=\normalsize,stepnumber=1,numbersep=5pt,
   breaklines=true,
   %firstnumber=last,
       %frame=tblr,
       framesep=5pt,
       basicstyle=\normalsize\ttfamily,
       showstringspaces=false,
       keywordstyle=\ttfamily\color{orange},
      %identifierstyle=\ttfamily,
       stringstyle=\color{maroon},
    commentstyle=\color{black},
    rulecolor=\color{gray!10},
    xleftmargin=0pt,
    xrightmargin=0pt,
    aboveskip=\medskipamount,
    belowskip=\medskipamount,
       backgroundcolor=\color{black}, #1
}}
{}
\usepackage{hyperref}
\usepackage{background}
\SetBgContents{}
\begin{document}
 \pagecolor{black}
 \color{green}
\begin{teX}
\documentclass{article}
\usepackage{graphicx}
\usepackage{listings}
\lstnewenvironment{teX}[1][]
\end{teX}
\end{document}