CSS System Colors (2021)
blog.jim-nielsen.com
blog.jim-nielsen.com
In my career I have rarely run across anyone trusted to make visual design calls who is humble enough to agree with the above. Two different shades of black depending on which browser the user chooses? "Quick, file a bug!"
I think it greatly depends on the website. For instance, I wouldn't expect a store's website to try to fit in with the user's system. Why should it? In that case, looking unique and standing out is a benefit. But if it's more of an app-type website, like a web mail client or some other utility that the user is likely to leave open for a while while working on stuff, then I think that's the type of site that should consider trying to fit in with the user's system. (Though I've never personally been of the opinion that I'd stop using an webapp just because it doesn't have darkmode or whatever.)
In case of a store, having say, a share button that matches the Android standard for it, rather than the Apple version, makes more sense to Android users. It makes your site easier to learn which is a benefit.
I am not saying all pages should be 100% "CanvasText" on "Canvas," and use the browser default font. There's so much room for customization that can be done. Splashes of color. One or two judiciously-chosen fonts that aren't jarring. However, the fact that we have at least 100,000 separate implementations of a 'dropdown/popup menu,' is not worth the downsides. Each of these custom controls has its unique bugs and accessibility flaws and they usually are inferior in many ways to the real UI elements that have been tuned for literal decades to work in all scenarios for all types of users.
Now if only I could find a use for #rebeccapurple again...
a:hover, maybe??
The spec is (unsurprisingly) quite [specific][1] that this color value is exactly "#663399". All browsers which implement CSS Colors have had support for years now and the Color Module itself is now a CR as of a year and a half ago.
Incompatibility isn't exactly a rounding error yet, but we're close.
[1]: https://lists.w3.org/Archives/Public/www-style/2014Jun/0312....
html.dark-mode { filter: grayscale(100%) invert(100%); }
Alternatively you can target elements individually, omitting images.
Note that the cost of this lazy method is very poor performance (css filter over the entire document), and lack of control over dark colours (inverted colours don't necessarily work best, shifting hue can help but you probably don't want the same as uninverted colours because they tend to be too dark and lack sufficient contrast).
Off topic, but the fact you felt a need to datestamp it indicates the Chrome Version Number System is bloody worthless.
Its support table is for the CSS2 system colours, as defined back in 1997. <https://www.w3.org/TR/WD-CSS2-971104/ui.html#h-18.2>
(Aside: “96.61%” is… well, for the type of browser they’re talking about—ones that support such things as CSS and colour—it should be exactly 100%, if not higher. Decide for yourself the sanity of this usage figure.)
CSS Color Module Level 3 <https://www.w3.org/TR/css-color-3/#css2-system> then deprecated them, for no good reason¹.²
CSS Color Module Level 4 <https://www.w3.org/TR/css-color-4/#css-system-colors> revived the concept of system colours, largely fixing the bad aspects and making it all clearly good. Some of the colours are still deprecated, with some at-risk³ dumbing-down. But there are also some new colours: Canvas and CanvasText.
So the problem is that that MDN compatibility data is talking about CSS2 system colours, not CSS Color Module Level 4, which has much lower support (and may not all have been implemented at the same time: most were probably added around 2019, but some in 2021 and AccentColor and AccentColorText in 2022).
Here are the actual colours, to help anyone who wants to update data (have fun identifying when they were added!):
• New in CSS Color Module Level 4: AccentColor, AccentColorText, ActiveText, ButtonBorder, Canvas, CanvasText, Field, FieldText, LinkText, Mark, MarkText, SelectedItem, SelectedItemText, VisitedText.
• Retained from CSS2: ButtonFace, ButtonText, GrayText, Highlight, HighlightText.
• Deprecated from CSS2: ActiveBorder, ActiveCaption, AppWorkspace, Background, ButtonHighlight, ButtonShadow, CaptionText, InactiveBorder, InactiveCaption, InactiveCaptionText, InfoBackground, InfoText, Menu, MenuText, Scrollbar, ThreeDDarkShadow, ThreeDFace, ThreeDHighlight, ThreeDLightShadow, ThreeDShadow, Window, WindowFrame, WindowText.
—⁂—
¹ Look, some of the system colours were clearly bad, modelling OS styles that were almost completely gone by this time. I suspect that some people didn’t like some of these too-specific values, and they threw the baby out with the bathwater.
² Earlier revisions mentioned the deprecation as being in favour of the ‘appearance’ property, but this was pretty stupid⁴ even when it was prospective, as first written, long before the ‘appearance’ property bit the dust for that time.
³ See <https://www.w3.org/TR/css-color-4/#deprecated-system-colors>: it defines fallback mappings that reduce the variations, but Firefox and Safari haven’t implemented the dumbing-down, still having the more-nuanced stuff they had from decades go. Hence “Results on these 'same as' equivalence tests are not great, which is why the feature is at-risk”.
⁴ No, seriously, just totally clueless and I have no idea what whoever wrote that was thinking, because it was always a completely different thing with only minimal potential overlap in uses.
Some colours are camelCase (currentColor), others are uncased (rebeccapurple) and I guess these system colours are TitleCase? (CanvasText)
I guess you just need to know!
> Note: Note that these keywords are case-insensitive, but are listed here with mixed case for readability.
As for currentColor, it follows SVG’s naming convention instead of CSS’s, because it was invented in SVG <https://www.w3.org/TR/SVG10/painting.html#SpecifyingPaint> and only adopted into CSS proper because people thought, “hey, that’s a useful feature, and we like aligning HTML-CSS and SVG-CSS where possible”. (Not sure if it was case-sensitive or not; element and attribute names are, so <svg> gets a viewBox attribute, and viewbox won’t work, which I’ve seen inline-SVG-unaware HTML minifiers mangle to.)
It has actually comparatively recently been partially renamed to currentcolor. https://www.w3.org/TR/css-color-4/ mostly refers to it as currentcolor, but still has currentColor in a few places. Not sure if these are editing errors or not. My favourite is: “The serialized form of ‘currentColor’ is the string "currentcolor".”
Though to be fair, TFA is an example of a step exactly in this direction.
iOS’s default “dark” stylesheet is, unfortunately, not usable, and I’ve wondered if there’s a workaround that doesn’t involve me hard-coding specific colors.
Edit: relevant WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=209851