54

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.
  • 875

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
  • 3
    I could not find an options to print/save it like this. Is there one? – 3244611user Sep 20 '16 at 12:10
  • 5
    awesome works for me , another way to do that simply Right click toolbar -> configure toolbar -> main tool bar -> toggle change color this will add shortcut to the option – Mohamed Slama Sep 06 '17 at 00:20
  • 2
    For scans of pages (like my textbook pdf), the Invert Colors color mode works really well. It inverts the image colors as well obviously, but for most diagrams that doesn't matter. – Michael Hoffmann Mar 02 '19 at 01:18
  • This is exactly what I was looking for. Who knows an option like this is hidden in the Accessibility options. – G 1 Jul 09 '19 at 14:06
  • 2
    Update Okular has a significantly better option now. Under the same accessibility configuration window, choose one of the Invert Luma color modes instead. This not only inverts the colors, but also rotates the hue, i.e. PDFs will be white text on black backgrounds, AND blues will be blues, and reds will be reds. (Available starting version 20.08.0) – craymichael Aug 19 '20 at 20:36
41

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
  • 3,444
  • 2
  • 34
  • 85
Marduk
  • 751
  • 1
    Thank you so much for mentioning Zathura, it's really great! Note for others: don't forget to install zathura-extras package in order to get support for djvu and ps. – M-x Aug 13 '15 at 09:19
  • Zathura can adjust colors of image-based PDF text too (scaned paper pages), something that most PDF viewers cannot do; as far as I know, the only other one that can is Master PDF. – cipricus Dec 18 '19 at 14:19
18

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
  • 3,444
  • 2
  • 34
  • 85
  • In master pdf is there any way to view the entire document in full screen, i.e. as the thing happens in acrobat reader. I want to view the entire page of the document to cover the entire rastor of my screen. I dont want the side, top and left and bottom panels remaining in full screen(just as the one happens in slide show) thank you... – Abhishek Ghosh Mar 23 '20 at 07:06
  • @AbhishekGhosh - in version 5.4.38: with F11 (View-Fullscreen) I only see the right scrollbar to the right, (nothing at top, left and bottom). You could ask a new question, link it here, and I'll provide a lengthy answer, considering version, screenshots etc. – cipricus Mar 23 '20 at 07:14
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.
  • 875
  • Adobe Reader 9 can do much more than Okular to improve readability. Okular cannot change font color as such, only inverts colors. – cipricus Dec 13 '19 at 15:09
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
  • 751
  • Have you noticed? — Master PDF Editor can change color of background and font even in a pdf made of image/scanned pages! — More details in my answer. – cipricus Dec 13 '19 at 14:25
  • Just to second that Master PDF Editor is a great tool. – Déjà vu Jul 15 '20 at 16:44
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
  • 68,507
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.

  • The OP specifically mentioned that the color of the text should not be altered. I once tried to modify Evince's source code to allow choosing the colors, but the way it was written requires non-trivial code refactoring to achieve that. – Marduk Jan 10 '19 at 14:46
  • 2
    The OP doesn't like inverted colors - which is sometimes even worse for the eyes - and so just wants the background a little darker. But the above answer is still useful in general. – cipricus Dec 13 '19 at 08:44
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,230
  • 3
    OP wrote in their question: "[...] I just get the inversion of colors as suggestion – which is sometimes even worse for the eyes." – Levente Apr 23 '21 at 23:25