MCPcopy Create free account
hub / github.com/stackblitz/bolt.new / initStore

Function initStore

app/lib/stores/theme.ts:15–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13export const themeStore = atom<Theme>(initStore());
14
15function initStore() {
16 if (!import.meta.env.SSR) {
17 const persistedTheme = localStorage.getItem(kTheme) as Theme | undefined;
18 const themeAttribute = document.querySelector('html')?.getAttribute('data-theme');
19
20 return persistedTheme ?? (themeAttribute as Theme) ?? DEFAULT_THEME;
21 }
22
23 return DEFAULT_THEME;
24}
25
26export function toggleTheme() {
27 const currentTheme = themeStore.get();

Callers 1

theme.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected