Created
November 12, 2020 15:50
-
-
Save HirbodBehnam/262356441604426b253340e7460df873 to your computer and use it in GitHub Desktop.
A tampermonkey script to enable dark mode even on local files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name PDF Dark Mode | |
// @namespace http://tampermonkey.net/ | |
// @version 1 | |
// @description A tampermonkey script to enable dark mode even on local files. | |
// @author Hirbod Behnam | |
// @match *://*/*.pdf | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Source: https://superuser.com/a/1527417/940438 | |
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); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment