(theme: Theme)
| 26 | }; |
| 27 | |
| 28 | function persistTheme(theme: Theme) { |
| 29 | try { |
| 30 | mkdirSync(CONFIG_DIR, { recursive: true }); |
| 31 | writeFileSync( |
| 32 | THEME_PREFERENCES_PATH, |
| 33 | JSON.stringify({ themeName: theme.name } satisfies ThemePreferences, null, 2), |
| 34 | "utf8", |
| 35 | ); |
| 36 | } catch { |
| 37 | // Ignore preference write failures so theme switching still works for this session. |
| 38 | } |
| 39 | }; |
| 40 | |
| 41 | type ThemeContextValue = { |
| 42 | colors: ThemeColors; |