Skip to content

Commit

Permalink
chore: update darkMode judgement
Browse files Browse the repository at this point in the history
  • Loading branch information
yzh990918 committed Mar 27, 2023
1 parent a19036d commit 39fbaa1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Themetoggle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const themeToggle = document.getElementById('themeToggle')
const themeCircle1 = document.querySelector('.theme_toggle_circle1')
const themeCircle2 = document.querySelector('.theme_toggle_circle2')
const toogleThemeCircle = () => {
const darkMode = localStorage.getItem('theme') === 'dark' || document.documentElement.classList.contains('dark')
const darkMode = document.documentElement.classList.contains('dark') ?? localStorage.getItem('theme') === 'dark'
if (darkMode) {
themeCircle1.setAttribute('r', '9')
themeCircle2.setAttribute('r', '9')
Expand Down

0 comments on commit 39fbaa1

Please sign in to comment.