Skip to content

Instantly share code, notes, and snippets.

@lweiss01
Last active March 18, 2022 03:26
Show Gist options
  • Save lweiss01/7a6c60843b64236b018e7398fb0d5f40 to your computer and use it in GitHub Desktop.
Save lweiss01/7a6c60843b64236b018e7398fb0d5f40 to your computer and use it in GitHub Desktop.
a dark mode toggle switch
javascript:(d=>{var css=`:root{background-color:#f1f1f1;filter:invert(1) hue-rotate(180deg)}img:not([src*=".svg"]),picture,video{filter: invert(1) hue-rotate(180deg)}`,style,id="dark-mode",ee=d.getElementById(id);if(null!=ee)ee.parentNode.removeChild(ee);else {style = d.createElement('style');style.type="text/css";style.id=id;if(style.styleSheet)style.styleSheet.cssText=css;else style.appendChild(d.createTextNode(css));(d.head||d.querySelector('head')).appendChild(style)}})(document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment