优化白色主题渲染逻辑

This commit is contained in:
CN-JS-HuiBai
2026-04-04 19:25:39 +08:00
parent 824ead4bee
commit 2d46729c27
3 changed files with 74 additions and 8 deletions

View File

@@ -13,9 +13,18 @@
// Prevent theme flicker
(function() {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'light') {
const settings = window.SITE_SETTINGS || {};
const defaultTheme = settings.default_theme || 'dark';
const theme = savedTheme || defaultTheme;
if (theme === 'light') {
document.documentElement.classList.add('light-theme');
}
// Also apply title if available to prevent flicker
if (settings.page_name) {
document.title = settings.page_name;
}
})();
</script>
</head>