feat(ui): 运营后台支持暗色模式与系统自适应切换
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user