Files

45 lines
1.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LobsterAI</title>
<script>
// 在页面加载前预设主题,避免闪烁
(function() {
try {
const savedConfig = localStorage.getItem('app_config');
if (savedConfig) {
const config = JSON.parse(savedConfig);
const theme = config.theme || 'system';
if (theme === 'dark') {
document.documentElement.classList.add('dark');
document.documentElement.style.backgroundColor = '#0F1117';
} else if (theme === 'light') {
document.documentElement.classList.add('light');
document.documentElement.style.backgroundColor = '#F8F9FB';
} else {
// 跟随系统
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
if (prefersDark) {
document.documentElement.classList.add('dark');
document.documentElement.style.backgroundColor = '#0F1117';
} else {
document.documentElement.classList.add('light');
document.documentElement.style.backgroundColor = '#F8F9FB';
}
}
}
} catch (e) {
console.error('Error applying theme early:', e);
}
})();
</script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/renderer/main.tsx"></script>
</body>
</html>