Created
October 17, 2020 20:16
-
-
Save heiswayi/9efcc456b65fd6242378c824d6e3dd77 to your computer and use it in GitHub Desktop.
Enforce dark mode
This file contains hidden or 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
function addCss(rule) { | |
let css = document.createElement('style'); | |
css.type = 'text/css'; | |
if (css.styleSheet) css.styleSheet.cssText = rule; | |
else css.appendChild(document.createTextNode(rule)); | |
document.getElementsByTagName("head")[0].appendChild(css); | |
} | |
var rule = ':root{background-color:#fff;filter:invert(100%)}*{background-color:inherit}img:not([src*=".svg"]),video{filter:invert(100%)}'; | |
addCss(rule); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment