fix: prevent flash of white background in dark mode

This commit is contained in:
weishu
2025-12-24 18:42:15 +08:00
parent 92d9546a9d
commit c47316d173
+13
View File
@@ -25,6 +25,19 @@
<!-- Safari Pinned Tab -->
<link rel="mask-icon" href="/mask-icon.svg" color="#111827" />
<!-- Prevent flash of white background on dark mode -->
<style>
html { background: #fff }
@media (prefers-color-scheme: dark) {
html { background: #1c1c1e; color-scheme: dark }
}
</style>
<script>
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.setAttribute('data-theme', 'dark')
}
</script>
<title>Hapi</title>
</head>
<body>