Replies: 1 comment
-
|
This issue is almost certainly not specific to Docusaurus itself, but rather a combination of:
The key clue is this:
That almost always means something persisted in localStorage, cookies, or cached CSS variables is overriding your theme logic. Likely root causeDocusaurus dark mode relies on:
If that value becomes inconsistent (for example Why it happens only on one Chrome profileBecause Incognito:
So it forces a clean theme initialization. Normal profile = polluted state persists. What to check first (most important)Open DevTools → Console and run: localStorage.getItem('theme')Also check: document.documentElement.getAttribute('data-theme')If these disagree, that’s your bug. Fixes1. Reset Docusaurus theme storageRun in console: localStorage.removeItem('theme');
location.reload();Or hard reset everything: localStorage.clear();2. Force correct theme initializationIn themeConfig: {
colorMode: {
defaultMode: 'light',
respectPrefersColorScheme: true,
disableSwitch: false,
},
}3. Check custom CSS for dark-mode conflictsYour CSS uses: [data-theme="dark"] {That is correct — but issues happen if:
One suspicious line: --docusaurus-highlighted-code-line-bgMake sure nothing outside this file is overriding body {
background: white !important;
}That breaks dark mode in some Chrome builds. 4. Chrome 110-specific issue (important context)Chrome 110 had known quirks with:
Fix is usually:
html {
color-scheme: light dark;
}This improves dark-mode correctness in older Chromium builds. Most probable explanation (based on your symptom)👉 Corrupted or stale Because:
Quick definitive fix checklistTry in order:
SummaryThis is not a Docusaurus bug — it's almost always:
If this answer helped or pointed you in the right direction, I'd appreciate it if you could mark it as the accepted answer so it's easier for others with the same issue to find. Also, if you found my contribution useful, I'd appreciate it if you could check out my GitHub profile, follow me, and star any repositories you find interesting. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have created a landing page that displays fine on Firefox, Safari and Google Chrome (Chrome on Linux and MacOS (Intel)). However, on a MacOS M1(arm64) when viewed in Chrome 110.0.5481.177 it fails to render in dark mode correctly as shown here.
Interestingly, if I try viewing the site in incognito mode or using a guest profile in chrome, the dark mode functions as expected. I have tried clearing the local and session storage in chrome for the user profile, in addition to all browsing data and the problem still persists.
Has anyone else encountered something similar with Docusaurus and Chrome 110.0.5481.177+ on Apple Mac
M1 arm64?
The
custom.cssis listed below:Beta Was this translation helpful? Give feedback.
All reactions