// ThemeSwitcher.tsx import { useEffect, useState } from 'react'; import { useTheme } from '../../hooks/useTheme'; import themes from '~/styles/themes.css'; import ThemeOption from './ThemeOption'; import { AsyncButton } from '../AsyncButton'; export function ThemeSwitcher() { const { theme, setTheme } = useTheme(); const initialTheme = { bg: "#1e1816", bgSecondary: "#2f2623", bgTertiary: "#453733", fg: "#f8f3ec", fgSecondary: "#d6ccc2", fgTertiary: "#b4a89c", primary: "#f5a97f", primaryDim: "#d88b65", accent: "#f9db6d", accentDim: "#d9bc55", error: "#e26c6a", warning: "#f5b851", success: "#8fc48f", info: "#87b8dd", } const { setCustomTheme, getCustomTheme } = useTheme() const [custom, setCustom] = useState(JSON.stringify(getCustomTheme() ?? initialTheme, null, " ")) const handleCustomTheme = () => { console.log(custom) try { const theme = JSON.parse(custom) theme.name = "custom" setCustomTheme(theme) delete theme.name setCustom(JSON.stringify(theme, null, " ")) console.log(theme) } catch(err) { console.log(err) } } useEffect(() => { if (theme) { setTheme(theme) } }, [theme]); return (

Select Theme

{themes.map((t) => ( ))}

Use Custom Theme