34

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.

| improve this question | | | | |
55

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.

| improve this answer | | | | |
  • 2
    I could not find an options to print/save it like this. Is there one? – 3244611user Sep 20 '16 at 12:10
  • 4
    awesome works for me , another way to do that simply Right click toolbar -> configure toolbar -> main tool bar <okular part> -> toggle change color this will add shortcut to the option – Mohamed Slama Sep 6 '17 at 0:20
  • 1
    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 2 '19 at 1:18
  • This is exactly what I was looking for. Who knows an option like this is hidden in the Accessibility options. – Jeewantha Samaraweera Jul 9 '19 at 14:06
29

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.

| improve this answer | | | | |
  • 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 9: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
10

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?).

| improve this answer | | | | |
  • 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
6

With most of the tools already mentioned under this question, only pdf files made out of text files (and not of scanned 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, Okular (as said in previous answers) 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 as image and saved as pdf)

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.

For text-based pdf files

(text-based= e.g. text files saved/exported/printed as pdf)

(A)

Beside Master PDF Editor and Zathura:

enter image description here

  • Foxit Reader for Linux has the option of changing both the color of background and of text — either by selecting a color profile

enter image description here

or by selecting any color

enter image description here

The limitations of this tool are that for the moment (version 2.4.4) it has no dark GUI (while not following a dark desktop theme) and no full-screen.

Having a large white area on the screen all the time while reading beats the purpose of improving readability, so I prefer other solutions.

(B)

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.


About Okular

(Considering its installation outside KDE, bringing that many dependencies looks problematic to me, but I may be wrong. In Xfce, it wants to install 100 of them. Trying to install as Flatpack: 798,8 MB will be downloaded in total. 2,7 GB more disk space will be used. — The method I used was Snapcraft - sudo snap install okular).

Okular can invert colors. It cannot change the font color, only that of the background (strictly what the OP asks: dimming the color of the page a bit. The page color cannot be set too dark, or it will get as dark as the font).

I think pdf documents can be made much more readable with other tools mentioned under this question, which can modify both page and font color.

The best thing that can be achieved with Okular is something like this:

enter image description here

I very much doubt Okular is the best tool for the purpose of readability, given that not only the above, but any other color combinations can be achieved by other methods.

enter image description here

| improve this answer | | | | |
  • 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 at 7: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 at 7:14
3

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.

| improve this answer | | | | |
  • 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
2

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"'
| improve this answer | | | | |
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.

| improve this answer | | | | |
  • 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
  • 1
    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 8:44
1

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.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.