Skip to content

Commit

Permalink
Update ThemeContext.js
Browse files Browse the repository at this point in the history
  • Loading branch information
anle9650 committed Sep 20, 2023
1 parent 5a388f7 commit 6913b4b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/src/modules/components/ThemeContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ export function ThemeProvider(props) {
}, [direction]);

useEnhancedEffect(() => {
document.documentElement.dataset.muiColorScheme = paletteMode;

// To support light and dark mode images in the docs
if (paletteMode === 'dark') {
document.body.classList.remove('mode-light');
Expand All @@ -201,8 +203,7 @@ export function ThemeProvider(props) {
document.body.classList.remove('mode-dark');
document.body.classList.add('mode-light');
}

document.documentElement.dataset.muiColorScheme = paletteMode;

const metas = document.querySelectorAll('meta[name="theme-color"]');
metas.forEach((meta) => {
meta.setAttribute('content', getMetaThemeColor(paletteMode));
Expand Down

0 comments on commit 6913b4b

Please sign in to comment.