Skip to content

Support prefers-color-scheme (dark mode) #34425

Closed
@nicoburns

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

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 in servoshell. We should also obtain an initial value from winit when creating the window.

Metadata

Assignees

No one assigned

    Labels

    A-layout/queryB-feature-trackingThis issue tracks a particular high-level featureB-newcomerNewcomer-friendly issues.E-less-complexStraightforward. Recommended for a new contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions