|
92 | 92 | const style = document.createElement('style'); |
93 | 93 | style.id = 'dark-mode-style'; |
94 | 94 | style.textContent = ` |
95 | | - body.dark-mode { background:#1a1a2e !important; color:#e0e0e0 !important; } |
96 | | - body.dark-mode * { color:#e0e0e0 !important; border-color:#0f3460 !important; } |
97 | | - body.dark-mode a { color:#4fc3f7 !important; } |
98 | | - body.dark-mode #site-nav { background:#16213e !important; } |
99 | | - body.dark-mode .sidebar, body.dark-mode #site-sidebar { background:#16213e !important; } |
100 | | - body.dark-mode .pane-bar { background:#16213e !important; } |
101 | | - body.dark-mode .editor-pane, body.dark-mode .preview-pane { border-color:#0f3460 !important; } |
| 95 | + body.dark-mode { background:#1a1a2e !important; color:#cdd6f4 !important; } |
| 96 | + body.dark-mode * { color:#cdd6f4 !important; border-color:#313244 !important; background-color:transparent !important; } |
| 97 | + body.dark-mode a { color:#89b4fa !important; } |
| 98 | + body.dark-mode #site-nav { background:#181825 !important; border-color:#313244 !important; } |
| 99 | + body.dark-mode .sidebar, body.dark-mode #site-sidebar { background:#181825 !important; } |
| 100 | + body.dark-mode .pane-bar { background:#181825 !important; border-color:#313244 !important; } |
| 101 | + body.dark-mode .editor-pane, body.dark-mode .preview-pane { border-color:#313244 !important; } |
| 102 | + body.dark-mode .page-body, body.dark-mode .main, body.dark-mode .layout { background:#1a1a2e !important; } |
| 103 | + body.dark-mode .example-card, body.dark-mode .ref-card, body.dark-mode .examples-section { background:#1e1e2e !important; border-color:#313244 !important; } |
| 104 | + body.dark-mode pre, body.dark-mode code, body.dark-mode .cm-static-wrap { background:#181825 !important; border-color:#313244 !important; } |
102 | 105 | body.dark-mode .btn-run { background:#e8b400 !important; color:#111 !important; } |
103 | | - body.dark-mode .btn-stop { background:#333 !important; color:#e0e0e0 !important; } |
| 106 | + body.dark-mode .btn-stop { background:#313244 !important; color:#cdd6f4 !important; } |
104 | 107 | body.dark-mode .nav-title-top, body.dark-mode .nav-title-bottom { color:#e8b400 !important; } |
105 | 108 | body.dark-mode #nav-errors-link { color:#e8b400 !important; } |
106 | | - body.dark-mode input, body.dark-mode textarea { background:#16213e !important; } |
107 | | - body.dark-mode .sidebar a.active { color:#e8b400 !important; } |
| 109 | + body.dark-mode .sidebar a.active { color:#e8b400 !important; font-weight:700; } |
| 110 | + body.dark-mode #nav-dark-btn { background:#313244 !important; color:#cdd6f4 !important; border-color:#45475a !important; } |
| 111 | + body.dark-mode .CodeMirror { background:#1e1e2e !important; } |
| 112 | + body.dark-mode input, body.dark-mode select, body.dark-mode textarea { background:#181825 !important; color:#cdd6f4 !important; } |
| 113 | + body.dark-mode ::placeholder { color:#6c7086 !important; } |
108 | 114 | `; |
109 | 115 | document.head.appendChild(style); |
110 | 116 | } |
111 | 117 | function applyDark(on) { |
112 | 118 | document.body.classList.toggle('dark-mode', on); |
113 | 119 | const btn = document.getElementById('nav-dark-btn'); |
114 | | - if (btn) { |
115 | | - btn.textContent = on ? '\u2600\uFE0F Light' : '\uD83C\uDF19 Dark'; |
116 | | - btn.style.background = on ? '#16213e' : '#111'; |
117 | | - btn.style.color = '#fff'; |
118 | | - btn.style.borderColor = on ? '#0f3460' : '#333'; |
119 | | - } |
| 120 | + if (btn) btn.textContent = on ? '☀️ Light' : '🌙 Dark'; |
120 | 121 | if (window.editor && window.editor.setOption) |
121 | 122 | window.editor.setOption('theme', on ? 'cppmode-dark' : 'cppmode'); |
122 | 123 | try { localStorage.setItem('darkMode', on ? '1' : '0'); } catch(e) {} |
|
0 commit comments