/** * The plugin is light only: wp-admin is white, and a black Recomaze inside * it read as a foreign object. The reference dashboard keeps its scheme * switch; here the hook answers "light" to whatever the synced components * ask, and boot clears the dark scheme a browser may have kept from before. */ export type Theme = 'light'; const STORAGE_KEY = 'recomaze_theme'; const CONTAINERS = '#recomaze, .recomaze-ui'; /** * Forgets a remembered dark scheme and takes the class off the containers. * * @returns {void} */ export function initTheme(): void { try { window.localStorage.removeItem(STORAGE_KEY); } catch { // A private window or blocked storage: there was nothing to forget. } document.querySelectorAll(CONTAINERS).forEach(element => { element.classList.remove('dark'); }); } /** * The scheme the app is painted in: always light. * * @returns {Theme} */ export function useResolvedTheme(): Theme { return 'light'; }