Forked from frontdevops/darkthemeswitcher-inline.js
Last active
December 8, 2020 14:57
-
-
Save dziku86/bebd35d8937cd152ff57c85687d7386f to your computer and use it in GitHub Desktop.
Simple Dark Theme Bookmarklet for web pages
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
javascript:(d=>{var css=`html{background:#fefefe;filter:invert(100%)}*{background:inherit}img:not([src*=".svg"]),video{filter:invert(100%)}`,style,id='dark-theme-snippet',ee=d.getElementById(id);if(null !=ee)ee.parentNode.removeChild(ee);else{style=d.createElement('style');style.id=id;style.styleSheet?style.styleSheet.cssText=css:style.appendChild(d.createTextNode(css));d.head.appendChild(style)}})(document) |
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
javascript: (d => { | |
var css = ` | |
html{ | |
background: #fefefe; | |
filter: invert(100%) | |
} | |
* { | |
background: inherit | |
} | |
img:not([src*=".svg"]), video{ | |
filter: invert(100%) | |
} | |
`, | |
style, | |
id = 'dark-theme-snippet', | |
ee = d.getElementById(id); | |
if (null != ee) ee.parentNode.removeChild(ee); | |
else { | |
style = d.createElement('style'); | |
style.id = id; | |
style.styleSheet | |
? style.styleSheet.cssText = css | |
: style.appendChild(d.createTextNode(css)); | |
d.head.appendChild(style) | |
} | |
})(document) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment