Reduce navigation flash with instant theme background and view transitions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-26 03:26:57 +08:00
parent aaf69329cb
commit cababd67f5
5 changed files with 51 additions and 5 deletions
+4
View File
@@ -19,10 +19,14 @@
theme = 'dark';
}
document.documentElement.setAttribute('data-theme', theme);
document.documentElement.style.colorScheme = theme;
document.documentElement.style.background = theme === 'light' ? '#e8eef8' : '#050508';
try {
localStorage.setItem(KEY, theme);
} catch (e) { /* ignore */ }
updateButtons(theme);
var meta = document.getElementById('meta-theme-color');
if (meta) meta.setAttribute('content', theme === 'light' ? '#e8eef8' : '#050508');
}
var saved = null;