mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 22:34:47 +00:00
fix: Check user's theme preference during page load (#156)
This commit is contained in:
@@ -42,8 +42,10 @@ export default class extends Controller {
|
||||
// Sets or removes the data-theme attribute
|
||||
setTheme(isDark) {
|
||||
if (isDark) {
|
||||
localStorage.theme = "dark";
|
||||
document.documentElement.setAttribute("data-theme", "dark");
|
||||
} else {
|
||||
localStorage.theme = "light";
|
||||
document.documentElement.setAttribute("data-theme", "light");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user