ยฉ 2026 Hedgehog Software, LLC
export const ThemeProvider: ParentComponent = ({ children }) => { const [currentTheme, setCurrentTheme] = createSignal(defaultThemeKey as ThemeKey); const themeContext = { themeKey: currentTheme, theme: createMemo(() => themes[currentTheme()]), setTheme: setCurrentTheme, }; return ( <ThemeContext.Provider value={themeContext}> {children} </ThemeContext.Provider> ); }; export const useTheme = () => { const context = useContext(ThemeContext); return context; }; export const ThemeSelector = () => { const theme = useTheme(); if (!theme) { console.warn("THEME-SELECTOR: useTheme returned undefined"); return null; } return ( <select onChange={(e) => theme.setTheme(e.target.value as ThemeKey)}> {Object.keys(themes).map((k) => ( <option value={k} selected={theme.themeKey() === k}>{k}</option> ))} </select> ); }
THEME-SELECTOR: useTheme returned undefined