You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm trying to incorporate a color mode that will prefer the user's system settings if selected, however, other color modes will overwrite the system preferences. Basically if theme-ui-color-mode in localstorage is set to system, it will use (prefers-media-query), but if it is set to light it will simply load the light color mode instead.
/* color mode selector component */const[colorMode,setColorMode]=useColorMode()/* this tracks the last selected mode that is not system preferences */const[userColor,setUserColor]=useState(colorMode!=='system' ? colorMode : 'default')consthandleSystemPref=({target: {checked}})=>setColorMode(checked ? 'system' : userColor)return(<><Switchchecked={colorMode==='system'}onChange={handleSystemPref}/>{colorMode!=='system'&&<><ButtononClick={()=>setColorMode('light')}>
Light
</Button><ButtononClick={()=>setColorMode('dark')}>
Dark
</Button><ButtononClick={()=>setColorMode('alt')}>
Alternate theme
</Button></>}</>)
Describe alternatives you've considered
One nice but not super valuable feature to have would be being able to define system preferences based modes for 'top level' modes
Is your feature request related to a problem? Please describe.
I'm trying to incorporate a color mode that will prefer the user's system settings if selected, however, other color modes will overwrite the system preferences. Basically if
theme-ui-color-mode
in localstorage is set tosystem
, it will use(prefers-media-query)
, but if it is set tolight
it will simply load the light color mode instead.Describe the solution you'd like
theme config
Describe alternatives you've considered
One nice but not super valuable feature to have would be being able to define system preferences based modes for 'top level' modes
Additional context
Visually this is what I want to happen
System preference is on => render color mode based on localstorage => prefers-color-scheme
System preference is off => render color mode based on localstorage => light
System preference is off => render color mode based on localstorage => dark
The text was updated successfully, but these errors were encountered: