Dark mode

Enable dark mode with only one line of CSS

  1. // ==UserScript==
  2. // @name Dark mode
  3. // @namespace https://github.com/EastSun5566
  4. // @version 0.0.5
  5. // @description Enable dark mode with only one line of CSS
  6. // @author Michael Wang
  7. // @license MIT
  8. // @match *://*/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. const style = document.createElement('style');
  14. style.textContent = `
  15. html {
  16. filter: invert(1) hue-rotate(180deg) contrast(0.8);
  17. }
  18.  
  19. /** reverse filer for media elements */
  20. img, video, picture, canvas, iframe, embed {
  21. filter: invert(1) hue-rotate(180deg);
  22. }
  23. `;
  24. document.head.appendChild(style);
  25. }());

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址