The Computer Oracle

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

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Lost Meadow

--

Chapters
00:00 How Can I Preview Pdfs With Google Chrome In Dark Mode?
00:28 Accepted Answer Score 50
01:02 Answer 2 Score 22
01:34 Answer 3 Score 1
02:01 Thank you

--

Full question
https://superuser.com/questions/1527410/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows #googlechrome #pdf #colortheme

#avk47



ACCEPTED ANSWER

Score 50


The following snippet adds a div overlay to any browser tab currently displaying a PDF document.

1. Open up your browser's Dev tools then browser console.
2. Paste this JavaScript code in your browser console:
const overlay = document.createElement("div");

const css = `
    position: fixed;
    pointer-events: none;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: white;
    mix-blend-mode: difference;
    z-index: 1;
`
overlay.setAttribute("style", css);

document.body.appendChild(overlay);
3. Hit Enter

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




ANSWER 2

Score 22


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.

Hint from Hirbot Behnam:
If you want to make it work with local files (e.g. PDFs) too, go to chrome://extensions/ and click on Details button below the extension "Dark Reader" and from there, enable Allow access to file URLs.

enter image description here




ANSWER 3

Score 1


If anyone still need this in 2024 and following up on this answer:

  • Enable Allow access to file URLs for the Dark Reader extension.
  • Click on the extension icon on the top right.
  • Click on the Dark Reader extension.
  • In the small Dark Reader window that just opened, click on the More tab.
  • Click on the All settings button at the bottom.
  • In the tab that just opened, click on Enable for PDF files.