Skip to content

Commit

Permalink
fix: 修复暗黑模式
Browse files Browse the repository at this point in the history
  • Loading branch information
markthree committed Jan 21, 2022
1 parent 362f0d6 commit f6e11c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<!-- <link rel="icon" href="/favicon.ico" /> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script>
(function () {
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
const setting = localStorage.getItem('vueuse-color-scheme') || 'auto'
if (setting === 'dark' || (prefersDark && setting !== 'light'))
document.documentElement.classList.toggle('dark', true)
})()
</script>
</head>

<body>
Expand Down

0 comments on commit f6e11c4

Please sign in to comment.