News for hackers. Stuff that matters.
Re:light-dark() by cantSpellSober on Thursday November 30, 2023 @08:33AM (#38473282)
What if, in the future, we have more than two options (light and dark)?

@media (prefers-color-scheme: [name]) seems more extensible, but this feels simpler and easier to read.

Glad the function accepts custom properties (CSS "variables").

Should probably add a color property that doesn't use this function as a fallback for browsers that don't support it.

Re:light-dark() by romellem on Thursday November 30, 2023 @11:28PM (#38483129)
prefers-color-scheme only [accepts two values][0] at the moment: light and dark. However, they acknowledge this may not be fixed to this enum forever

> The values for this feature might be expanded in the future (to express a more active preference for light color schemes, or preferences for other types of color schemes like "sepia"). As such, the most future-friendly way to use this media feature is by negation such as (prefers-color-scheme: dark) and (not (prefers-color-scheme: dark)), which ensures that new values fall into at least one of the styling blocks.

[0]: https://drafts.csswg.org/mediaqueries-5/#prefers-color-schem...

Re:light-dark() by cantSpellSober on Friday December 01, 2023 @06:53AM (#38485759)
That's what I was getting at, thanks for the reference!
Re:light-dark() by Kiuhrly1 on Friday December 01, 2023 @09:15AM (#38486891)
There is already a media query for contrast preferences (increased or decreased) IIRC