You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the color mode flash prevention only handles foreground and background colors for the <body> element, which means that colors used in other elements will still flash on page load. The styles generated by the ColorMode component could optionally include all values as CSS custom properties, and the ThemeProvider component could map the values used in context to their relevant custom properties instead of raw color values.
This should be an opt-in feature since custom properties are not supported in IE 11.
The text was updated successfully, but these errors were encountered:
I messed around with this a couple of weeks ago here. Landed on adding an includeCSSVariables prop to ThemeProvider that created the CSS properties through Emotion's Global component so it should be SSR friendly.
If you think that's similar to what you're thinking I'd be happy to start a PR and discuss things further :)
@souporserious Awesome! This isn't too far off from what I was thinking. The current ColorMode component also uses Global (it'd be great if global CSS could generally be avoided though). With theme-ui and color modes, I think it'd make sense for each mode's custom properties were on something like a .theme-ui-color-<MODE> selector so that the render-blocking script used on page load would only need to apply a single classname to the <body> element
Currently the color mode flash prevention only handles foreground and background colors for the
<body>
element, which means that colors used in other elements will still flash on page load. The styles generated by theColorMode
component could optionally include all values as CSS custom properties, and theThemeProvider
component could map the values used in context to their relevant custom properties instead of raw color values.This should be an opt-in feature since custom properties are not supported in IE 11.
The text was updated successfully, but these errors were encountered: