Brandon Presley
dc27ae9868
Previously it was possible to choose a color combination that was almost impossible to read (due to contrast). Now we have prevented this from happening, as well as giving the user more customizability.
23 lines
582 B
TypeScript
23 lines
582 B
TypeScript
import {createContext, useContext} from 'react'
|
|
import {DarkTheme, DefaultTheme} from 'react-native-paper'
|
|
|
|
export const ThemeContext = createContext<{
|
|
theme: string
|
|
lightColor: string
|
|
setTheme: (value: string) => void
|
|
setLightColor: (value: string) => void
|
|
darkColor: string
|
|
setDarkColor: (value: string) => void
|
|
}>({
|
|
theme: 'system',
|
|
lightColor: DefaultTheme.colors.primary,
|
|
setTheme: () => null,
|
|
setLightColor: () => null,
|
|
darkColor: DarkTheme.colors.primary,
|
|
setDarkColor: () => null,
|
|
})
|
|
|
|
export function useTheme() {
|
|
return useContext(ThemeContext)
|
|
}
|