3 ms·
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 t
by graypegg 4y ago
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)
I guess you just need to know!
- runarberg 4y agoThese are actually case insensitive but are documented in different cases for claimed readability. From mdn (https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#system_colors https://developer.mozilla.org/en-US/docs/Web/CSS/color_value...): > Note: Note that these keywords are case-insensitive, but are listed here with mixed case for readability.
- deleted 4y ago[deleted]
- chrismorgan 4y agoFun thing is that the system colours were originally written in lowercase <https://www.w3.org/TR/WD-CSS2-971104/ui.html#h-18.2 https://www.w3.org/TR/WD-CSS2-971104/ui.html#h-18.2>, then they dallied with kebab-case <https://www.w3.org/TR/1998/PR-CSS2-19980324/ui.html#system-colors https://www.w3.org/TR/1998/PR-CSS2-19980324/ui.html#system-c...>, but they finally settled on TitleCase <https://www.w3.org/TR/1998/REC-CSS2-19980512/ui.html#system-colors https://www.w3.org/TR/1998/REC-CSS2-19980512/ui.html#system-...>. 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 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/ 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".”