about summary refs log tree commit diff
path: root/src/alf/util/useColorModeTheme.ts
blob: 79cebc1394dcd154b8fd26ac462a264914c966e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import {useColorScheme} from 'react-native'

import * as persisted from '#/state/persisted'

export function useColorModeTheme(
  theme: persisted.Schema['colorMode'],
): 'light' | 'dark' {
  const colorScheme = useColorScheme()
  return (theme === 'system' ? colorScheme : theme) || 'light'
}