feat(ui): 运营后台支持暗色模式与系统自适应切换

This commit is contained in:
yml
2026-11-20 23:12:39 +08:00
parent e6a9c2d81e
commit 7c2e01fb7e
8 changed files with 636 additions and 46 deletions
+16
View File
@@ -12,6 +12,22 @@
<link rel="icon" href="/favicon.ico" sizes="16x16 32x32 48x48" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<title>运营后台管理中心</title>
<script>
;(function () {
try {
var pref = localStorage.getItem('app-theme-preference')
var isDark =
pref === 'dark' ||
(!pref &&
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
var theme = isDark ? 'dark' : 'light'
document.documentElement.setAttribute('data-theme', theme)
document.documentElement.classList.toggle('dark', isDark)
document.documentElement.style.colorScheme = theme
} catch (_) {}
})()
</script>
</head>
<body>
<div id="root"></div>