My new post: “Querying the Color Scheme”.
https://blog.kizu.dev/querying-the-color-scheme/
Media queries are nice, but for many things, we don’t even need them: there is this great #CSS property `color-scheme`, which allows us to make various things adapt to the current color scheme. We can even set it on a per-element basis. This post describes how we can use registered custom properties and style queries to read the current value of a `light-dark()` color for styling any non-color properties as well.
As usual, credits:
- @bramus for his article about `light-dark()`.
- @anniegreens for her post about what she learned about `color-scheme`.
- @argyleink for his recent post about adaptive light/dark color schemes.
- @pepelsbey for the mention of one important difference between `prefers-color-scheme` and `color-scheme` in the latest @webstandards_ru podcast episode.
- @tabatkins for the `<meta name=color-scheme>` CSSWG issue.