/** * Theme values (BR-3: only 'red' and 'purple' are valid). * Actual token colors live in src/index.css (.theme-red / .theme-purple); * this module only owns the *selectable* theme identifiers and the * localStorage key used for persistence (BR-2). */ export type ThemeName = 'red' | 'purple'; export const THEMES: ThemeName[] = ['red', 'purple']; export const DEFAULT_THEME: ThemeName = 'red'; export const THEME_STORAGE_KEY = 'slp-software-theme'; /** BR-3: fall back to the default theme for anything that isn't a valid ThemeName. */ export function isValidTheme(value: unknown): value is ThemeName { return value === 'red' || value === 'purple'; } export function resolveInitialTheme(storedValue: string | null): ThemeName { if (isValidTheme(storedValue)) { return storedValue; } return DEFAULT_THEME; } export function themeClassName(theme: ThemeName): string { return `theme-${theme}`; }