Ashhar commited on
Commit
afcd851
·
1 Parent(s): 9e31351

make dark theme as default

Browse files
Files changed (1) hide show
  1. app/lib/stores/theme.ts +4 -4
app/lib/stores/theme.ts CHANGED
@@ -9,16 +9,16 @@ export function themeIsDark() {
9
  return themeStore.get() === 'dark';
10
  }
11
 
12
- export const DEFAULT_THEME = 'light';
13
 
14
  export const themeStore = atom<Theme>(initStore());
15
 
16
- function initStore() {
17
  if (!import.meta.env.SSR) {
18
- const persistedTheme = localStorage.getItem(kTheme) as Theme | undefined;
19
  const themeAttribute = document.querySelector('html')?.getAttribute('data-theme');
20
 
21
- return persistedTheme ?? (themeAttribute as Theme) ?? DEFAULT_THEME;
22
  }
23
 
24
  return DEFAULT_THEME;
 
9
  return themeStore.get() === 'dark';
10
  }
11
 
12
+ export const DEFAULT_THEME = 'dark';
13
 
14
  export const themeStore = atom<Theme>(initStore());
15
 
16
+ function initStore(): Theme {
17
  if (!import.meta.env.SSR) {
18
+ const persistedTheme = localStorage.getItem(kTheme) || (DEFAULT_THEME as Theme | undefined);
19
  const themeAttribute = document.querySelector('html')?.getAttribute('data-theme');
20
 
21
+ return (persistedTheme ?? themeAttribute) as Theme;
22
  }
23
 
24
  return DEFAULT_THEME;