![]() ![]() UseSystemColorMode is a boolean that indicates if Chakra UI must subscribes (and updates) based on the operating system's color mode changes. InitialColorMode value is used to determine the value on first visit, or after a storage reset. Difference between initialColorMode='system' and useSystemColorMode # In case you need to reset the color mode, you must delete the item in the specified storage (localStorage, cookie manager or custom), so on next page load the value is initialized like the first time user visited the page. To achieve that, please use initialColorMode: "system" If user specifies useSystemColorMode: true, then we'll subscribe to color If the initial value is system, then we'll compute the color mode using.If value doesn't exist, use the initialColorMode value specified. Get the color mode value in the specified storage (localStorage, cookie manager or custom) The current hierarchy of how Chakra UI resolves the color mode: If set to false, the app's color mode is detached from the system color mode. ![]() UseSystemColorMode: If true, Chakra UI subscribes to changes in system color mode. InitialColorMode: The initial mode you'd like your app to start with when user visit the page for first time (or after storage reset). The theme config for color mode has 2 options: ![]() Your application should start with to either light, dark or system. Update your theme config to determine how Chakra UI should manage color modeĪdd the ColorModeScript to your application, and set the initial color mode To get dark mode working correctly, you need to do two things:
0 Comments
Leave a Reply. |