mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-24 14:55:37 +00:00
fix: default theme to system, set data-theme attribute on DOM
- Default preference to 'system' so first-run users get OS preference detection - Set data-theme attribute on documentElement alongside .dark class toggle
This commit is contained in:
@@ -25,7 +25,7 @@ function getStoredPreference(): ThemePreference {
|
||||
} catch {
|
||||
// Ignore storage errors
|
||||
}
|
||||
return "dark";
|
||||
return "system";
|
||||
}
|
||||
|
||||
function resolveTheme(pref: ThemePreference): ResolvedTheme {
|
||||
@@ -39,6 +39,7 @@ function resolveTheme(pref: ThemePreference): ResolvedTheme {
|
||||
|
||||
function applyThemeToDOM(theme: ResolvedTheme) {
|
||||
const root = document.documentElement;
|
||||
root.dataset.theme = theme;
|
||||
if (theme === "dark") {
|
||||
root.classList.add("dark");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user