Skip to content

Instantly share code, notes, and snippets.

@hamoid
Created February 6, 2016 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamoid/316787ebcbc1d929f9da to your computer and use it in GitHub Desktop.
Save hamoid/316787ebcbc1d929f9da to your computer and use it in GitHub Desktop.
Bookmarklet that makes pages dark, by applying white background to everything, then applying filter invert and grayscale
javascript:(function()%20{%20var%20tag%20=%20document.createElement('style');%20tag.type%20=%20'text/css';%20document.getElementsByTagName('head')[0].appendChild(tag);%20tag[%20(typeof%20document.body.style.WebkitAppearance=='string')%20?%20'innerText'%20:%20'innerHTML']%20=%20'*%20{%20background-color:%20white%20!important;%20color:%20#444%20!important;%20%20}%20html%20{%20filter:%20invert(100%)%20grayscale(100%);%20}';%20})();
@hamoid
Copy link
Author

hamoid commented Feb 6, 2016

Not perfect, it works on most pages, in some it works partially, and it GitHub somehow it does nothing! :)

@mmccall0813
Copy link

If you want an always dark theme on Wikipedia and you have an account, you can go to "preferences", then "appearance", and next to the appearance you have selected, there will be a button called "Custom CSS" click that, then click "Create Page", and paste the following: html,img,video{-webkit-filter:invert(1)hue-rotate(180deg);filter:invert(1)hue-rotate(180deg)}body{background:#000}

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