use-theme.ts 352 B

12345678910111213
  1. import { Theme } from '@/types/app'
  2. import { useTheme as useBaseTheme } from 'next-themes'
  3. const useTheme = () => {
  4. const { theme, resolvedTheme, ...rest } = useBaseTheme()
  5. return {
  6. // only returns 'light' or 'dark' theme
  7. theme: theme === Theme.system ? resolvedTheme as Theme : theme as Theme,
  8. ...rest,
  9. }
  10. }
  11. export default useTheme