by kickingvegas · 1mo ago · 0 comments
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/V...
I was a theme junkie back in Windows 98 times, but stopped bothering since it became increasingly clear that Microsoft was not really interested in supporting them after XP.
The underlying problem is Chrome exposes no (normal) setting to override the OS level setting at all, not necessarily that the preference shall always follow the browser's theme specifically.
So if the user sets dark mode in the browser, do they not explicitly express their preference for websites? How could they be more explicit about the setting?
[1]https://drafts.csswg.org/mediaqueries-5/#prefers-color-schem...
Safari and Firefox are pretty small.
- <meta name="color-scheme" content="light dark">
- :root { color-scheme: light dark }
- @media (prefers-color-scheme: dark) { }
- <picture><source media="(prefers-color-scheme: dark)">
.... and then we've got `light-dark()`, the goofy looking dragon hanging out to the side of these majestic, forward-thinking parts of the specification.Did they not look at the prior art and notice that "one of these things is not like the other?" All the other pieces of this puzzle, conceivably, could have one day had something like `:root { color-scheme: halloween }` or `@media (prefers-color-scheme: supercontrast)` but no, we're just going to cement `light-dark()` as the only two possible color schemes we'd ever want to switch between forever.
Also, prefers-contrast media query exists, which can be used in combination with the luminance modes (color-scheme): halloween-light, halloween-dark, halloween-light-high-contrast, halloween-dark-high-contrast.
And by naming the function `light-dark()`, they explicitly left the door open to introduce something like you suggest in the future. Had they already named the function something more generic, it would limit the flexibility of any future API!
It's not like CSS was pure and elegant to begin with, so why not add an oddity that is actually useful?