@sanity/ui
Version:
The Sanity UI components.
18 lines (13 loc) • 365 B
text/typescript
import {useContext} from 'react'
import {ThemeContext} from './themeContext'
import {ThemeContextValue} from './types'
/**
* @public
*/
export function useRootTheme(): ThemeContextValue {
const value = useContext(ThemeContext)
if (!value) {
throw new Error('useRootTheme(): missing context value')
}
return value as unknown as ThemeContextValue
}