Dark Read The Docs

Dark theme for all "Read The Docs" websites.

  1. // ==UserScript==
  2. // @name Dark Read The Docs
  3. // @version 1.3
  4. // @namespace Dark Read The Docs
  5. // @include *
  6. // @grant none
  7. // @description Dark theme for all "Read The Docs" websites.
  8. // ==/UserScript==
  9. function addGlobalStyle(css) {
  10. var head,
  11. style;
  12. head = document.getElementsByTagName('head')[0];
  13. if (!head) {
  14. return;
  15. }
  16. style = document.createElement('style');
  17. style.type = 'text/css';
  18. style.innerHTML = css;
  19. head.appendChild(style);
  20. }
  21.  
  22. var nodes = document.querySelectorAll(".rst-current-version");
  23. if (nodes.length == 0) {
  24. return;
  25. }
  26. addGlobalStyle('html,body,.wy-nav-content,.highlight,.reference,.subnav,.n,.k,.ow,.wy-nav-content-wrap,.admonition\
  27. {background:none#000!important;color:#bbb!important;text-shadow:none!important;}\
  28. dt,.reference,.highlighted,.admonition-title{background:none#222!important;color:#bbb!important;text-shadow:none!important;}\
  29. input,code\
  30. {background:none#222!important;color:#ddd!important;text-shadow:none!important;}\
  31. input { border:1px solid #00f!important;}\
  32. {visibility: hidden}\
  33. ');