Reverse PDF background color from white to black in Chrome
If you fall in love with dark mode.However, you have to read a lot of PDF files every single day and light background makes you uncomfortable.You have came right place
Now , let us go into detail.(〃 ̄︶ ̄)人( ̄︶ ̄〃)
-
Right-click on the PDF document which you want to open.
-
Go to Open with > Google Chrome.
-
Press SHIFT + CTRL + I to open the console.
-
Make sure that you’re on the Console tab.
-
Copy the following code and paste it into the console and hit Enter:
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);
Don't worry , this effect is not permanent if you close your browser.
The modifications DISAPPEAR as soon as you close the browser or tab.`(>﹏<)′
Here it the result
Before :
After :
Whenever you want to enable dark mode for PDF file. You have to comeback this topic to copy & paste this tiny script, it's silly ? Now, let me tell you how to create a simple short cut:
-
Copy this script above.
-
Find your bookmark on Google Chrome | Microsoft Edge & choose "Add page".
-
With field "Name": Write whatever you want. To illustrate, "Dark Mode PDF" is chosen by me.
-
With field "URL": Paste the script into it.
-
Click on "Save" & you have a short cut to enable Dark Mode for PDF file easily.
-
Have a coffee & enjoy your work.
I don't know you and you don't know me. Probably we are not even living in the same country. We look different. We speak different languages. Maybe we are from entirely different generations. We are just complete strangers.
But there is something that connects us. We both have great taste in getting programming
Thank you for being here. God bless you, whoever you are