|
96 | 96 | function applyDark(on) { |
97 | 97 | document.body.setAttribute('data-dark', on ? '1' : ''); |
98 | 98 | const btn = document.getElementById('nav-dark-btn'); |
99 | | - if (btn) btn.textContent = on ? '☀️' : '🌙'; |
| 99 | + if (btn) { |
| 100 | + btn.textContent = on ? '☀️' : '🌙'; |
| 101 | + btn.style.background = on ? '#16213e' : '#111'; |
| 102 | + btn.style.color = on ? '#e0e0e0' : '#fff'; |
| 103 | + btn.style.borderColor = on ? '#0f3460' : '#333'; |
| 104 | + } |
100 | 105 | const nav = document.getElementById('site-nav'); |
101 | 106 | const sb = document.getElementById('site-sidebar') || document.querySelector('.sidebar'); |
102 | | - if (nav) { nav.style.background = on ? '#16213e' : ''; nav.style.borderColor = on ? '#0f3460' : ''; } |
103 | | - if (sb) { sb.style.background = on ? '#16213e' : ''; } |
| 107 | + if (nav) { nav.style.background = on ? '#16213e' : ''; nav.style.borderColor = on ? '#0f3460' : ''; nav.style.color = on ? '#e0e0e0' : ''; } |
| 108 | + if (sb) { sb.style.background = on ? '#16213e' : ''; sb.style.color = on ? '#e0e0e0' : ''; } |
| 109 | + // Make all links and muted text visible |
| 110 | + document.querySelectorAll('a, .sidebar a, #site-nav a, p, span, h1, h2, h3, li, label').forEach(el => { |
| 111 | + if (on) { if (!el.style.color || el.style.color === 'rgb(170, 170, 170)' || el.style.color === '#aaa') el.style.color = '#e0e0e0'; } |
| 112 | + else { el.style.color = ''; } |
| 113 | + }); |
104 | 114 | document.body.style.background = on ? '#1a1a2e' : ''; |
105 | 115 | document.body.style.color = on ? '#e0e0e0' : ''; |
| 116 | + // Editor-specific: pane bars |
| 117 | + document.querySelectorAll('.pane-bar, .editor-pane, .preview-pane').forEach(el => { |
| 118 | + el.style.background = on ? '#16213e' : ''; |
| 119 | + el.style.borderColor = on ? '#0f3460' : ''; |
| 120 | + el.style.color = on ? '#e0e0e0' : ''; |
| 121 | + }); |
106 | 122 | try { localStorage.setItem('darkMode', on ? '1' : '0'); } catch(e) {} |
107 | 123 | } |
108 | 124 | window.__toggleDark = function() { |
|
0 commit comments