import { useContext } from 'react' import { AdminThemeContextInstance, type AdminThemeValue } from './admin-theme-context' /** * Reads the admin theme context. * * Throws when used outside a provider rather than returning a default. A silent * default would let a component render with the wrong theme and never report the * mistake, which is exactly the class of bug this codebase's tooling exists to * surface. */ export function useAdminTheme(): AdminThemeValue { const value = useContext(AdminThemeContextInstance) if (!value) { throw new Error('useAdminTheme must be used inside an AdminThemeProvider') } return value }