From 6913b4b8c0777b5af19d0c2b45c956d8cace0e98 Mon Sep 17 00:00:00 2001 From: anle9650 Date: Tue, 19 Sep 2023 22:26:25 -0600 Subject: [PATCH] Update ThemeContext.js --- docs/src/modules/components/ThemeContext.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/src/modules/components/ThemeContext.js b/docs/src/modules/components/ThemeContext.js index 92efb208e695a0..63369296299bdb 100644 --- a/docs/src/modules/components/ThemeContext.js +++ b/docs/src/modules/components/ThemeContext.js @@ -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'); @@ -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));