Metronic Default, React, ThemeModeType switched to 'system', bad css styles after refresh.
After switching ThemeModeType to 'system' and refresh the page, css are not applied correctly.
Replies (1)
Hi,
We have a problem with "system" mode in the current Metronic React version, we already fixed this issue and included a fix in the next release.
For now, as a temporary solution, you can update theme script inside file public/index.html.
Copy the following code and paste it into index.html.
<script>
if(document.documentElement){
let themeMode = "system"; if (localStorage.getItem("kt_theme_mode_value")) {
themeMode = localStorage.getItem("kt_theme_mode_value");
}
if (themeMode === "system") {
themeMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
}
document.documentElement.setAttribute("data-bs-theme", themeMode);
}
</script>
Regards,
Lauris Stepanovs,
Keenthemes Support Team