Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

fix: default theme to system, set data-theme attribute on DOM

webadderall8cd6a61f44e0
diff --git a/src/contexts/ThemeContext.tsx b/src/contexts/ThemeContext.tsx
index 616a4be7..4c3566ad 100644
--- a/src/contexts/ThemeContext.tsx
+++ b/src/contexts/ThemeContext.tsx
@@ -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 {