cpprefrence.com 暗黑主题

cppreference.com 网页黑暗模式主题

  1. // ==UserScript==
  2. // @name cpprefrence.com 暗黑主题
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.5
  5. // @description cppreference.com 网页黑暗模式主题
  6. // @author You
  7. // @match *://*.cppreference.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=cppreference.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. ; (function () {
  14. 'use strict'
  15. document.documentElement.hidden = true
  16. document.addEventListener("DOMContentLoaded", ready);
  17. function ready() {
  18. console.log('styleload');
  19.  
  20.  
  21. if (document.getElementById("mycomtomstyle")) return;
  22. var style = document.createElement('style')
  23. style.id = "mycomtomstyle";
  24. let backgroundcolor = '#232529'
  25. let fontColor = '#cccccc'
  26. style.innerHTML = `
  27. .mainpagetable tr.row td {
  28. background: ${backgroundcolor};
  29. border: none !important;
  30. }
  31. body{
  32. background: none repeat scroll 0 0 ${backgroundcolor};
  33.  
  34. }#bodyContent{font: 15px/20px BlinkMacSystemFont,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;}
  35. div#cpp-content-base,.sitedir-ltr textarea,.t-navbar-menu > div,
  36.  
  37. table.wikitable, .sitedir-ltr input,div#cpp-footer-base ,table.ambox ,div.vectorTabs span,div.vectorMenu ul,div.vectorMenu h5 span {
  38. background: ${backgroundcolor};color: #fff;
  39. }
  40. div#cpp-head-second-base {
  41. background: ${backgroundcolor};
  42. }
  43. div#cpp-head-first-base {
  44. border-bottom: 1px solid #eee;
  45. background: ${backgroundcolor};
  46. }
  47. div#content {
  48. color: ${fontColor};
  49. }
  50. h1, h2, h3, h4, h5, h6 {
  51. color: ${fontColor};
  52. }a {
  53. color: #52935f;
  54. }a:visited {
  55. color: #607fb3;
  56. }
  57. .t-spar {
  58. color: #cfcfcf;
  59. }
  60. .cpp.source-cpp .kw4 {
  61. color: #8383ff;
  62. }.mw-geshi a {
  63. color: #669efc;
  64. }
  65. .cpp.source-cpp .de1, .cpp.source-cpp .de2 {
  66. font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;
  67. color:#4dc9b0;
  68. }
  69. .cpp.source-cpp {font-family:monospace;}
  70. .cpp.source-cpp .imp {font-weight: bold; color: red;}
  71. .cpp.source-cpp li, .cpp.source-cpp .li1 {font-weight: normal; vertical-align:top;}
  72. .cpp.source-cpp .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
  73. .cpp.source-cpp .li2 {font-weight: bold; vertical-align:top;}
  74. .cpp.source-cpp .kw1 {color: #569cd6;}
  75. .cpp.source-cpp .kw2 {color: #569cd6;}
  76. .cpp.source-cpp .kw3 {color: #8484ff;}
  77. .cpp.source-cpp .kw4 {color: #3d90d6;}
  78. .cpp.source-cpp .co1 {color: #7181b6;}
  79. .cpp.source-cpp .co2 {color: #339900;}
  80. .cpp.source-cpp .coMULTI {color: #7181b6; font-style: italic;}
  81. .cpp.source-cpp .es0 {color: #008000; font-weight: bold;}
  82. .cpp.source-cpp .es1 {color: #008000; font-weight: bold;}
  83. .cpp.source-cpp .es2 {color: #008000; font-weight: bold;}
  84. .cpp.source-cpp .es3 {color: #008000; font-weight: bold;}
  85. .cpp.source-cpp .es4 {color: #008000; font-weight: bold;}
  86. .cpp.source-cpp .es5 {color: #008000; font-weight: bold;}
  87. .cpp.source-cpp .br0 {color: #ffd700;}
  88. .cpp.source-cpp .sy0 {color: #008000;}
  89. .cpp.source-cpp .sy1 {color: #d4d4d4;}
  90. .cpp.source-cpp .sy2 {color: #d4d4d4;}
  91. .cpp.source-cpp .sy3 {color: #d4d4d4;}
  92. .cpp.source-cpp .sy4 {color:#cccccc;}
  93. .cpp.source-cpp .st0 {color: #f1fa8c;}
  94. .cpp.source-cpp .nu0 {color: #b5cea8;}
  95. .cpp.source-cpp .nu6 {color: #6161ff;}
  96. .cpp.source-cpp .nu8 {color: #8080ff;}
  97. .cpp.source-cpp .nu12 {color: #a9a9ff;}
  98. .cpp.source-cpp .nu16 {color:#a2a2ff;}
  99. .cpp.source-cpp .nu17 {color:#7777ff;}
  100. .cpp.source-cpp .nu18 {color:#7f7fff;}
  101. .cpp.source-cpp .nu19 {color:#9595ff;}
  102. .cpp.source-cpp .me2 {color:#4dc9b0;}
  103. /*代码高亮*/
  104. pre {
  105. color: #8cdcfe;
  106. }
  107.  
  108. pre,
  109. div.mw-geshi {
  110. background-color: #282a36;
  111. border: 1px solid #313131;
  112.  
  113. }
  114.  
  115. table {
  116. border-color: #2b2b2b;
  117. }
  118.  
  119. .t-rev>td:nth-child(1),
  120. table.ambox,
  121. .t-rev>td:nth-child(2),
  122. .t-rev-inl {
  123. border: 1px solid #3c3c3c;
  124. }
  125.  
  126. .t-c {
  127. border: none;
  128. background-color: #323545;
  129. padding: 0px 4px;
  130. margin: 2px;
  131. display: inline-block;
  132.  
  133. }
  134.  
  135. .mw-geshi.cpp.source-cpp {
  136. border: none;
  137. background-color: #323545;
  138. color: #868d9a !important;
  139. display: inline-block;
  140. border-radus: 2px;
  141. }
  142.  
  143. .mw-geshi.cpp.source-cpp * {
  144.  
  145. color: #868d9a !important;
  146. }
  147.  
  148. .t-c * {
  149. color: #868d9a !important;
  150. }
  151.  
  152. p,
  153. dd {
  154. line-height: 1.4em;
  155. margin: 10px 0;
  156. }
  157.  
  158. ul {
  159. list-style-type: initial;
  160. list-style-image: none;
  161. }
  162.  
  163. .t-sdsc-sep {
  164. border-top: 1px solid #504545;
  165. padding: 0;
  166. }
  167.  
  168. table.wikitable>tr>th,
  169. table.wikitable>*>tr>th {
  170. background-color: #232529;
  171. text-align: center;
  172. color: #cccccc
  173. }
  174.  
  175. table.wikitable>tr>th,
  176. table.wikitable>tr>td,
  177. table.wikitable>*>tr>th,
  178. table.wikitable>*>tr>td {
  179. border: 1px #5e5e5e solid;
  180. padding: 0.2em;
  181. }
  182.  
  183. div.vectorTabs li.selected a,
  184. div.vectorTabs li.selected a:visited {
  185. color: #c0c0c0;
  186. text-decoration: none;
  187. }
  188. `
  189. document.body.appendChild(style);
  190. document.documentElement.hidden = false
  191. }
  192.  
  193. // Your code here...
  194. })()