'How to change color-scheme dynamically in react app

in my react app I want to dynamically change the color scheme like the image above but it's not working at all (it doesn't change scroll bar color), knowing that any other attribute like "background-color" is working as expected.



Solution 1:[1]

Try to enable CSS baseline style:

...
import CssBaseline from "@mui/material/CssBaseline";

...
<ThemeProvider theme={theme}>
  {/* A collection of HTML element and attribute style-normalizations. */}
  <CssBaseline enableColorScheme />
  ...
</ThemeProvider>
...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Expert Ngobeni