aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/theme/useThemeMode.ts
blob: 9769684b2b3acd8cc596a4d96e9b92e91a9b0f7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { useContext } from 'react'
import { ThemeModeContext, type ThemeModeValue } from './themeModeContext'

export function useThemeMode(): ThemeModeValue {
  const context = useContext(ThemeModeContext)

  if (context === null) {
    throw new Error('useThemeMode must be used inside ThemeModeProvider')
  }

  return context
}