56

Its quite common that one wishes or has to read lots of PDF files which are intended to be printed, but since one would read them only once, and one wishes to save some trees, one reads them on Acrobat Reader, evince, xpdf or whatever your choice.

It would be an advantage to be able to control the background's color. Instead of black text on white background, I'd like to have a gray background. By googling I just get the inversion of colors as suggestion – which is sometimes even worse for the eyes.

Is there a pdf reader allowing me to change background color (without changing the color of the text)?

Edit: The first comment below suggests it depends on the file. Therefore I added to the title arXiv's.

c.p.
  • 895

9 Answers9

73

You can do this in Okular if you don't mind pulling in kde dependencies.

sudo apt-get install okular

The option is found in Settings/Configure Okular.../Accessibility by checking Change colors then Color mode: Change Paper Color and select a color in the swatch below. Works with several pdf files I have from arxiv, but perhaps unsurprisingly, doesn't work with pdf files that are simply scans of pages.

Jason Conti
  • 2,371
43

There is another possibility. Install zathura. It is a lightweight PDF, DJVU and PS reader. It is highly configurable and of course it allows changing the color of the background and the text. Just add these lines to ~/.config/zathura/zathurarc:

set recolor true
set recolor-darkcolor "#dcdccc"
set recolor-lightcolor "#1f1f1f"

The above color variables will give you this:

enter image description here

I also recommend you to set these options:

set window-title-basename "true"
set selection-clipboard "clipboard"

For help go to the Arch forums.

Look here for mouse and key bindings.

Disclaimer: I am in no way related to the development of zathura. I am just a happy user.

cipricus
  • 4,066
  • 4
  • 47
  • 106
Marduk
  • 771
19

With most of the tools already mentioned under this question, only pdf files made out of text files (and not of scanned/photocopied text saved as image) can be treated so that colors of page and fonts (or at least of page, as expected by the OP) are changed. In case the available text is a pdf formed of images (e.g. paper that was scanned) the pages will in many cases show paper-like black-on-white text (even if images are extracted and converted to an ebook format as said here). There, the only possible color change of image-based pdf-s is inverting colors with viewers that have that option: Evince, Qoppa-PDFStudioViewer), xpdf (with the -rv argument, see here), mupdf (here). There are exceptions, though, viewers that can do more than just inverting colors or changing only the background:

For all pdf (including image-based) files

(image-based = e.g. a book or article scanned/photocopied and saved as pdf)

Okular:

In newer versions of Okular (like 1.9.3) both font and page colors can be edited — and a dark-mode look can be enabled — through a new and rather non-intuitive setting, under Configure Okular - Accessibility - Color mode: Change Dark and Light Colors, by selecting a light color for dark and a dark one for light color option.

enter image description here

Then, for easy access, configure toolbar and add Toggle change color. It works for picture/scanned pages too.

enter image description here

enter image description here

and

can change color of both pages and fonts even in image-based pdf files.

enter image description here

enter image description here

Select "more" to have any color:

enter image description here

With an image/scanned text, a value of#3b3537 for the page color and #b0afac for the font color gives this:

enter image description here

Thus, a scanned pdf text can be read with different color profiles, just like an epub can in an ebook reader.


E-book readers

Most eBook readers offer color settings for page and font, but only some of them can open pdf documents. As far as I can tell they do not display the text as well as a pdf viewer in all cases. I have tested only two:

  • Bookworm - it has 3 color profiles but each profile can be edited (fully adjustable colors for background and fonts under Preferences). Poor pdf text rendering in the document tested by me - sometimes lacking spaces between words and wrong display of non-English accented characters.

  • Calibre's Ebook Viewer - better rendering of pdf text (very few problems with the same document tested in Bookworm). Color settings are accessed by opening a book, right-clicking, then selecting Preferences - Colors.

The quality of pdf display in an ebook reader may depend on the pdf too. I have noticed that, when trying to open a pdf, ebook readers run pdftohtml tool.


NOTE on UPDATES to this answer: Initially, this answer covered other apps with links to their state of development. I have removed some of those because: the info links were dead, it's hard for me to keep up with all changes, some apps behave very poorly (Foxit), some (Adobe Reader) became unsupported, their hacky installation is hazardous, and also pointless, given we have native alternatives, mentioned above.

cipricus
  • 4,066
  • 4
  • 47
  • 106
12

The given answer based on okular is perfect.

Another option is to configure Acrobat Reader to do that.

Go to

Edit > Preferences > Accessibility > Replace Document Colors > Check box in Custom Colors

then choose your colors; the new preferences are loaded automatically next time you open the same kind of pdf's (LaTeX generated?).

c.p.
  • 895
4

You can use the cross-platform Master PDF Editor, which is closer in functionality to Adobe Acrobat than to a mere PDF reader.

In Tools > Settings > Display activate Replace Document Colors and choose the colors that you want to use. Click Ok.

Open a PDF file and in the View menu select Replace Document Colors.

Marduk
  • 771
3

xpdf was the first to do this, I think. I discovered this option in it several years ago.

You can read about it in the man page, but I just made an alias, since I usually open PDF files from the terminal (which I basically never close while I am doing anything in my computer).

The alias is:

alias xpdf='xpdf -cont -papercolor "#aab"'
pomsky
  • 70,557
3

Emacs!

Install pdf-tools from melpa and enable pdf-view-midnight-minor-mode in pdf-view-mode. The default color for midnight mode is light grey on dark blue but this can be changed by configuring pdf-view-midnight-colors, eg.

(setq pdf-view-midnight-colors '("#000000" . "#dcdcdc"))

PS: It works on scanned copies too.

2

Dark Mode in Pdf

As shown in the image it is possible with the default PDF viewer "Document Viewer". just select that setting option and there is inverted colours mode which pretty much does the job.

1

You can use arxiv.black

Replace '.org' with '.black' on the Arxiv.org PDF and enjoy dark mode.

This is how it looks like enter image description here

tinlyx
  • 3,328