Greasy Fork 支持简体中文。

Auto dark mode HN

Dark mode Hacker News, respecting your system preferences.

  1. // ==UserScript==
  2. // @name Auto dark mode HN
  3. // @version 1.0
  4. // @description Dark mode Hacker News, respecting your system preferences.
  5. // @author 1_player
  6. // @match https://news.ycombinator.com/*
  7. // @grant GM_addStyle
  8. // @license MIT
  9. // @namespace https://greasyfork.org/users/930341
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. GM_addStyle(`
  16. @media (prefers-color-scheme: dark) {
  17.  
  18. body {
  19. background-color: black;
  20. }
  21.  
  22. table#hnmain {
  23. background-color: #333;
  24. }
  25.  
  26. a:link, .c00, .c00 a:link {
  27. color: #ddd;
  28. }
  29.  
  30. .comhead a:link, .subtext, .subtext a:link, .subtext a:visited {
  31. color: #999;
  32. }
  33.  
  34. textarea {
  35. background-color: #444;
  36. color: white;
  37. }
  38.  
  39. .pagetop a {
  40. color: #000;
  41. }
  42. }
  43. `);
  44.  
  45. })();