Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Enforce dark mode
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));
var rule = ':root{background-color:#fff;filter:invert(100%)}*{background-color:inherit}img:not([src*=".svg"]),video{filter:invert(100%)}';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.