import { SchemeName , ThemeName } from '@redux-devtools/ui' ; import { CHANGE_THEME } from '../constants/actionTypes' ; import { StoreAction } from '../actions' ; export interface ThemeState { readonly theme : ThemeName ; readonly scheme : SchemeName ; readonly colorPreference : 'auto' | 'light' | 'dark' ; } export function theme ( state = { theme : 'default' , scheme : 'default' , colorPreference : 'auto' , } , action ) { if ( action . type === CHANGE_THEME ) { return { theme : action . theme , scheme : action . scheme , colorPreference : action . colorPreference , } ; } return state ; }