17

How can I preview PDFs with Google Chrome in dark mode / reverse color?

By default it is white colored:

Screenshot showing question author looking at arxiv.org research archive PDF, in Google Chrome

Followed-up by my asking How can I change the grey background of the PDF preview in Google Chrome to black?.

2
  • Chrome is not part of Windows, why did you tag it Windows?
    – Mark
    Feb 22 '20 at 6:03
  • @Mark in case of OS-dependent solution. Feb 22 '20 at 6:06
35

Paste this JavaScript code in your console:

var cover = document.createElement("div");
let css = `
    position: fixed;
    pointer-events: none;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: white;
    mix-blend-mode: difference;
    z-index: 1;
`
cover.setAttribute("style", css);
document.body.appendChild(cover);

Special thanks: https://www.reddit.com/r/chrome/comments/e3txhi/comment/fem1cto

4
8

You can use the Dark Reader Google Chrome extension and used the Filter+ mode. It will work on the online PDF files, but not at the local PDF files.

enter image description here

5
  • 1
    it works, thank you!
    – Lonely
    Jul 26 '20 at 18:22
  • 1
    If you want to make it work with local files too, go to chrome://extensions/ and click on Details button below the extension and from there, enable Allow access to file URLs. Nov 12 '20 at 15:53
  • This did not work for me when opening local pdfs
    – MaLiN2223
    Nov 30 '20 at 21:07
  • @MaLiN2223 Correct, this doesn't work when opening local pdfs, which is quite annoying. Nov 30 '20 at 22:16
  • I tried using this option on Firefox, and it also does not work on online pdfs. It says that the website is protected... May 13 '21 at 12:51

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.