MCPcopy Create free account
hub / github.com/chokcoco/iCSS / initializeTheme

Function initializeTheme

website/app/lib/theme.ts:57–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55}
56
57export function initializeTheme() {
58 const theme = getStoredTheme();
59 applyTheme(theme);
60
61 // 监听系统主题变化
62 if (typeof window !== 'undefined') {
63 const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
64 mediaQuery.addEventListener('change', () => {
65 if (getStoredTheme() === 'system') {
66 applyTheme('system');
67 }
68 });
69 }
70}

Callers 1

AppProviderFunction · 0.90

Calls 2

getStoredThemeFunction · 0.85
applyThemeFunction · 0.85

Tested by

no test coverage detected