Really a big fan of the underlying theme (no pun intended) here which is that your website or webapp should care significantly more about visually fitting in with the user's system, settings, and preferences than it should about expressing your corporate branding and looking the same on every device in the world. Users don't care about your "brand colors" and every "unique" UI element only serves to make their task of learning your site more annoying.
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!"
> your website or webapp should care significantly more about visually fitting in with the user's system, settings, and preferences than it should about expressing your corporate branding and looking the same on every device in the world.
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 that case, looking unique and standing out is a benefit.
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.
(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 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.
¹ 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.
The article points out that while system colors are supported in Firefox (as of the time of the writing of the article), the "color-scheme: light dark" method he was using was not supported, and it looks like that was not supported until Firefox 96 (January 2022).[0]
You could use the shorthand, but it's really not necessary at this point.
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.
I've used something to this effect before, and you can use child selectors on e.g images to effectively exclude elements.
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).
If you use just invert(100%), no grayscale, on the body, you can add img { filter: invert(100%) } to reverse images back to their original color. However, if an image has any transparency or translucency, it may be harder to see with what the background color has become.
The CSS spec is always interesting for how much very useful stuff there is in it that’s buried under a magic incantation. I mean that as in, there’s little in the syntax to hint at the fact that Canvas as a colour exists.
Some colours are camelCase (currentColor), others are uncased (rebeccapurple) and I guess these system colours are TitleCase? (CanvasText)
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".”
I’m mid 30s and have been writing front end code since the late 90s and it never ceases to amaze me how straightforward and easy it has become. When XMLHttpRequest came out it felt like a HUGE hack to load stuff that wasn’t xml. In fact the only way to have a half decent website was to use an arsenal of hacks because browsers sucked
CSS is so frustrating. I've been dabbling in it for a decade and I still keep finding new, interesting incompatibilities. When will default browser stylesheets finally look decent enough to not need CSS for simple text-based sites?
Though to be fair, TFA is an example of a step exactly in this direction.
I'm also pretty bad at things i only dabble in. My Spanish is terrible, but that's not because Spanish is an inherently flawed language. It's because I haven't put in the consistent work to get good at it.
Good point. However, other technologies such as C++ or bash I can not touch for a year or two, then just bang out a small script when I need. But your point is certainly correct.
And to be fair to you, I do concede that the process of learning CSS is messier and requires a bit more rote memorization than learning a "real" programming language.
I’ll look at the stylesheet later, but how are they avoiding links on iOS being dark blue on a dark background?
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.
I peeked at the site's stylesheet, and (it's pretty convoluted, but...) it appears to just be setting links to a theme color. So it seems they don't have a solution to this problem either :)
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!"