Supporting CSS variables would: - https://github.com/mui-org/material-ui/issues/12827#issuecomment-649595621: open up avoiding flickering of dark mode websites implemented in frameworks like Next.js or Gatsby! (This seems to be the case on the https://material-ui.com/ website itself! Eg. if you set dark mode and refresh, the page will briefly show up in light mode, and then change to dark mode, causing a flicker) Problem demonstrated: https://joshwcomeau.com/css/css-variables-for-react-devs/#dark-mode-flash-fix Solution with CSS variables: https://joshwcomeau.com/gatsby/dark-mode/ - #25018: make the switch between dark and light feel more instant. Relying on CSS cascading will always be faster than React context cascading. ### Benchmark - https://react-spectrum.adobe.com/react-spectrum/theming.html -
Supporting CSS variables would:
Problem demonstrated: https://joshwcomeau.com/css/css-variables-for-react-devs/#dark-mode-flash-fix
Solution with CSS variables: https://joshwcomeau.com/gatsby/dark-mode/
Benchmark