forked from netease-youdao/LobsterAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
44 lines (43 loc) · 1.58 KB
/
index.html
File metadata and controls
44 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!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>