Closed
Description
Description
prefers-color-scheme
is a CSS feature which allows CSS to conditionally set styles based on the user's preference for light or dark mode.
MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
Spec: https://drafts.csswg.org/mediaqueries-5/#prefers-color-scheme
Implementation plan
- Enable
prefers-color-scheme
stylo#93 enables this feature in Stylo (which is doing all the hard work for us). - Make Servo compatible with Stylo with
prefers-color-scheme
support #34423 updates Servo to use that version of Stylo (but hardcodes "light mode").
The remaining work is to:
- Add an embedder event for setting the preferred color scheme
- Plumb this through to the layout thread where it should be set on the device (possibly via a "reflow", similar to window size?)
- Connect this to Winit
ThemeChanged
events inservoshell
. We should also obtain an initial value from winit when creating the window.