Colour mode in Chakra

Colour mode in Chakra UI is not working. What is the best way to implement it

Hey. If this is the same course where the Aside is not working, I would see if changing to an older version of chakra fixes the issues. If that doesn’t work, tell me which version of Chakra UI that you are using so I can help troubleshoot.

1 Like

I’m currently using the current version v3.34

In Chakra UI the most reliable way is using ColorModeScript + ChakraProvider with a proper theme config, and controlling it via useColorMode() / useColorModeValue(). If it’s not working, it’s usually a theme/provider setup issue.

For Chakra UI v3, the ColorModeScript/useColorMode advice above is for v2. V3 uses next-themes for color mode; add a provider that wraps ChakraProvider and use useColorMode from the generated color-mode snippet. Check the v3 docs’ setup, since copying v2 examples will fail.