Skip to content

Instantly share code, notes, and snippets.

@lnikkila
Last active June 8, 2020 00:34
Show Gist options
  • Save lnikkila/ae5685661c23d0d7f636 to your computer and use it in GitHub Desktop.
Save lnikkila/ae5685661c23d0d7f636 to your computer and use it in GitHub Desktop.
Instant night mode for any website! https://lnikki.la/articles/night-mode-css-filter/
Bookmarklet

Copy and paste this into a bookmark:

javascript:!function(d){d.head.appendChild(d.createElement("style")).innerText="html,img,video{-webkit-filter:invert(1)hue-rotate(180deg);filter:invert(1)hue-rotate(180deg)}body{background:#000}"}(document);
html, img, video {
-webkit-filter: invert(1) hue-rotate(180deg);
filter: invert(1) hue-rotate(180deg);
}
body {
background: black;
}
@torappinfo
Copy link

For webview/chrome 81, this does not work. changing html to body as "body,img,video{filter:invert(1)}" seems work but make some pages completely black.
So, what is the difference between html and body?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment