Hook useColorMode is called outside the <ColorModeProvider>.
See original GitHub issueHey,
I’m following the documentation example here : https://redocusaurus.vercel.app/docs/getting-started/Installation
My package JSON contains the following dependencies :
"@docusaurus/core": "2.0.0-beta.18",
"@docusaurus/preset-classic": "2.0.0-beta.18",
"docusaurus-lunr-search": "2.1.15",
"redocusaurus": "1.0.2"
My presets look like this in my config file :
presets: [
[
require.resolve('@docusaurus/preset-classic'),
{
docs: { ... },
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
},
],
[
'redocusaurus',
{
specs: [
{
spec: 'myyamlfile.yaml',
route: '/testpage/',
},
],
// Theme Options for modifying how redoc renders them
theme: {
// Change with your site colors
primaryColor: '#1890ff',
},
},
],
],
When accessing /testpage, I see the following :

Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:17 (9 by maintainers)
Top Results From Across the Web
Bug: useColorMode returned undefined colorMode if you use ...
Correction: Hooks actually get triggered, but the "colorMode"-value is "undefined". And this is unexpected, because everything else works: the ...
Read more >useColorMode imported from Theme UI plugin in React-based ...
Looking at the doumentation link you provided, the useThemeUI hook return value seems to contain the theme , components , colorMode and ...
Read more >Color Mode - Chakra UI
useColorMode is a React hook that gives you access to the current color mode, and a function to toggle the color mode. Toggle...
Read more >Theme configuration - Docusaurus
useColorMode . A React hook to access the color context. This context contains functions for setting light and dark mode and exposes boolean ......
Read more >Dark Mode - xstyled
Use the useColorMode hook in your application to change the color mode. This value will be stored in localStorage and used whenever the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the same problem, downgrading to 1.0.1 did not work.
@rohit-gohri Thank you so much for the great library and the great help. I think my company is adopting Redocusaurus and once it’s all styled up I’ll drop a link for you to showcase. ❤️