// 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, themeName, 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 themeData = JSON.parse(custom) setCustomTheme(themeData) setCustom(JSON.stringify(themeData, null, " ")) console.log(themeData) } catch(err) { console.log(err) } } return (