Skip to content

Commit 9f75a01

Browse files
committed
nav.js: dark mode fixes - gray text, button color, editor panes
1 parent 6439e62 commit 9f75a01

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

assets/nav.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,29 @@
9696
function applyDark(on) {
9797
document.body.setAttribute('data-dark', on ? '1' : '');
9898
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+
}
100105
const nav = document.getElementById('site-nav');
101106
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+
});
104114
document.body.style.background = on ? '#1a1a2e' : '';
105115
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+
});
106122
try { localStorage.setItem('darkMode', on ? '1' : '0'); } catch(e) {}
107123
}
108124
window.__toggleDark = function() {

0 commit comments

Comments
 (0)