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

2 Answers

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:

6

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

6

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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