Skip to content

Commit

Permalink
fix: light theme flickering (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
loveloki authored Sep 16, 2024
1 parent 5ab98b6 commit a5a2635
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 0 additions & 9 deletions src/components/ThemeSelect.astro
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ import lightThemeIcon from '@assets/icons/light-sun.svg?raw'
/** Update select menu UI, document theme, and local storage state. */
#onThemeChange(theme: Theme): void {
ThemeProvider.updatePickers(theme)
const themeFinal =
theme === 'auto' ? this.#getPreferredColorScheme() : theme
if (themeFinal === 'light') {
document.body.classList.add('light')
document.body.classList.remove('dark')
} else {
document.body.classList.add('dark')
document.body.classList.remove('light')
}
document.documentElement.dataset.theme =
theme === 'auto' ? this.#getPreferredColorScheme() : theme
this.#storeTheme(theme)
Expand Down
2 changes: 1 addition & 1 deletion src/styles/_color.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ body {

}

body.light {
html[data-theme="light"] body {
--bg-color: #fff;
--border-color: #dedede;
--border-extra: #dedede;
Expand Down

0 comments on commit a5a2635

Please sign in to comment.