-
DescriptionHow can i keep dark mode by default Link to ReproductionSteps to reproduce
Chakra UI Versionlatest Browserchrome Operating System
Additional InformationMy theme configimport { extendTheme } from "@chakra-ui/react"
const config = {
initialColorMode: "dark",
useSystemColorMode: false,
}
const theme = extendTheme({ config })
export default theme So, you can see that the dark mode is enabled by default, but it's not appearing. Users can only enable dark mode after clicking on the dark mode button. |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 2 replies
-
It is set to Dark Mode, but you are experiencing an already known issue per the documentation There are some solutions others have come up with. I cannot vouch for their effectiveness. |
Beta Was this translation helpful? Give feedback.
-
I have already gone through the documentation. I am using nextjs to generate the pages on the server. So, why not This way theme config will get preference and if default theme is light then light pages will be generated, if default theme is dark then dark pages will be generated. |
Beta Was this translation helpful? Give feedback.
-
Hydration. SSR does not produce a static page. You'll note that when you load or refresh the page your text shifts because of the astronaut image loading. Did you implement what was suggested above the previous doc link I sent? It's about SSR and flashing.
|
Beta Was this translation helpful? Give feedback.
-
I am using SSG not SSR.
Not yet! |
Beta Was this translation helpful? Give feedback.
-
The current situation is that you need help debugging your site. |
Beta Was this translation helpful? Give feedback.
-
What is the use of the prop |
Beta Was this translation helpful? Give feedback.
-
@ats1999 one possible reason why this issue still exists for you is that at one point during development the chakra-ui set a flag in your local storage stating that the theme was |
Beta Was this translation helpful? Give feedback.
-
Hey, it's loading the dark theme, but still it's flashing. |
Beta Was this translation helpful? Give feedback.
-
maybe override your HTML to the color you want, manually and let chakra take care of it later on? |
Beta Was this translation helpful? Give feedback.
-
This way, I need to customize everything, including text, heading, box, shadow, etc.. |
Beta Was this translation helpful? Give feedback.
-
@ats1999 if the only issue you're having is the slight flashing, the core team is working on that issue, please bear with them. |
Beta Was this translation helpful? Give feedback.
@ats1999 if the only issue you're having is the slight flashing, the core team is working on that issue, please bear with them.