12

When a PDF is opened, its actual background color is often white. On Windows, several PDF viewers have the ability to set the background color to another one, which doesn't modify the PDF file itself. You can just think that it adds a virtual color when a file is opened by those software. But when you open the same file by other softwares, it still has white background.

I often need to read many articles (PDF format) a day, and white background make my eyes feel uncomfortable.

Does Preview have the same feature? Or any plugin to do this?

13

So Preview does not have this feature, but more on that in a moment.

f.lux

I would strongly recommend you take a look at f.lux.

f.lux makes your computer screen look like the room you're in, all the time. When the sun sets, it makes your computer look like your indoor lights. In the morning, it makes things look like sunlight again.

f.lux will adjust (you can modify the strength) the colour of the whole screen to make it easier on your eyes. You can set it to be on all the time, or automatically come on at night time. People love it.

Now, back to your question...

Adobe Reader for Mac does support this. Once you install the 400MB app, you can change the background colour in Preferences (⌘ cmd + ,) > * Accessibility** . Check Replace Document Colours, and set the right colours you want.

screenshot of Adobe Reader accessibility preferences

1
  • the mention of f.lux is a distraction -- at least I could find no way to see white text on a black background -- which is what the original question asks for. The solution offered (Acrobat) may work, but at the price of loading a hefty piece of software that many do not like. Besides, the original question is specifically asking about using Preview. – Tony M Nov 14 '20 at 12:22
2

You can change the background color in Skim (a popular and lightweight app for viewing, highlighting, annotating, and editing PDFs). Open up your document in Skim, then open up the (Apple) Script Editor (search script in the spotlight search), paste the following script in there and run it:

tell application "Skim"
    set theColor to choose color
    set page background color to theColor
end tell

This opens up the Skim color chooser from which you can choose your desired background color. Unfortunately the changes are not persistant. So for easier changes in future, save the script (the Script Editor's default saving location is iCloud), and then for subsequent changes all you have to do is to open the scirpt editor, double click the script, and run it. See Here for more details.

Please note that if you change the background color using the Skim UI, only the surrounding color changes, rather than the document's background color.

4
  • Doesn't seem to work for image-based PDFs (e.g. scans). – Ariel Apr 2 '18 at 8:50
  • 2
    Not working for me with current version (Skim Version 1.4.38)... Did work with a previous version, though. – Neal Young Nov 27 '18 at 14:11
  • Not working for latest version(1.5.8) – gpanda May 11 '20 at 19:14
  • 1
    sourceforge.net/p/skim-app/feature-requests/1371 As the maintainer said, "You cannot do this (Apple script) anymore because Apple has made it impossible on Sierra". – gpanda May 11 '20 at 19:23
1

npm i -g serve && serve, open file in Chrome from http://localhost:5000, Chrome extension Dark Reader > enable dark for this domain

1

Here's what I do, no coding, no plug in.

Click on tools, select annotation, then mask.

You should see a grey frame now. Adjust the size of the frame to let the gray area cover the whole page. You do have to repeat this step for each page in the document.

0
0

A more simple way to do it.

  • Open Terminal
  • copy and paste defaults write -app skim SKPageBackgroundColor -array 0.78 0.93 0.80 1
  • reopen Skim
0
0

At least on El Captain (or even earlier release):

  1. Open Preview > Preference
  2. General > Windows background
1
  • 5
    I think that changes the background of the window, not the document itself. – Fang Jing Sep 12 '16 at 23:56
0

Here is a work around for those who want to use Preview:

  1. In Preview, File>Export>TIFF
  2. View>Show Markup Toolbar
  3. In the Adjust Color Tool, switch the outer handles as shown in the animated .gif below
  4. repeat for each page then File>Export>PDF enter image description here

Here's a workaround for a large number of pages, but it involves using ffmpeg and Automator

  1. Use QuickTime to make a screen recording (m.mov) of the white background pdf while clicking from page to page at, say 2 pages every second
  2. ffmpeg -i m.mov -vf negate neg.mov
  3. ffmpeg -i neg.mov -r 2.0 sub/%03d.jpg
  4. select all .jpg's in the sub folder, right click and choose the Automator action shown below to make a new PDF

The first ffmpeg command inverts the colors of the screen recording and the second ffmpeg command places images from the screen recording into a sub folder at the rate of 2 per second. Converting the resulting images into a PDF is done with a very simple Automator action, shown below:

enter image description here

The above do not preserve text, but produce images. If you want text and are okay with using something other than Preview, then the free version of PDF Expert described here is a good solution.

5
  • While this technically 'works', it's a terrible idea. You lose all text and PDF metadata, and the file size will increase massively. Plus the degradation of vector images to bitmap. Oh, and if I want to change the colour...? It would be far simpler just to apply a Quartz Filter to the PDF. – benwiggy Nov 14 '20 at 12:00
  • If you want text, see the link I provide at the end. Regarding file size, a 13 page pdf I used for testing went from .4 to 1.4MB with virtually no quality loss. Quality can be controlled at the steps where you convert to images. – Tony M Nov 14 '20 at 12:04
  • So only a 3.5 x increase, then! There are easier ways to tint a PDF without converting to bitmaps. – benwiggy Nov 14 '20 at 12:08
  • I like Tony’s answer more because it taught me a trick I hadn’t seen +1. I get the drawbacks @benwiggy mentions, but this is a very useful technique - even more so when we understand what it strips. Sometimes I want to flatten a file so I can OCR. “Simple” and “apply a quartz filter” aren’t synonymous for me yet... also, this is a moderately “heavy” solution if the intent is only to view a PDF and not actually transform it. It’s a super clear explanation how to chain tools together. – bmike Nov 14 '20 at 12:34
  • @benwiggy please show us how to apply your method, which you describe as a "far simpler just to apply a Quartz Filter to the PDF". Like bmike, I also don't know how to do this, so please provide step by step detail. Thanks. – Tony M Nov 15 '20 at 11:13
0

I just found a really cool inverted pdf app on github: https://github.com/eleloya/NightPDF

Preview:enter image description here

As the repo now is read only, I did some changes in a forked repo.

  • Change default color
  • Change the deault window size to (1000, 1300)
  • Add close window shortcut (CMD + W)

You can download it here: https://github.com/yueyericardo/NightPDF/releases/tag/v0.2.1.5

enter image description here

0

A simple workaround to change the background color in Skim is to (ab)use the reading bar preferences:

  • Go to Preferences/Display in the app
  • Find the reading bar preferences
  • Select the desired color and opacity (50-80% depending on the color)
  • Tick the Invert Bar box

Preferences

All this does is add a layer of color over the top of the pdf. So adjusting the opacity is the key. At 100% the document is completely hidden; at 30% the trick has little effect. Here's an example that gives Skim a solarized feel (Hex color = #B68A00, opacity = 50%).

Output

If you never use the reading bar for its intended purpose, this workaround won't interfere with your usual use of the app. Two advantages of this approach are

  1. Easy to toggle on/off using cmd + shift + b
  2. Fast to change the color from a "dark mode" to a "light mode" and back

One word of caution: Inverting the reading bar makes the whole document your desired color and the reading bar an awful glaring white. It's advisable to minimize the size (height) of the reading bar and tuck it somewhere out of the way. Here's an example in "dark mode" (Hex color = #002B37, opacity = 75%).

dark mode Skim hack with reading line

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .