-
Notifications
You must be signed in to change notification settings - Fork 715
[css-color-4] Do we actually need hwb()? #6940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'd be a bit sad as I just implemented DevTools support for it in Firefox. And I believe it's a good sign that And couldn't The mentioned two issues do also apply to other color functions, so they can't be closed just because of the removal of Though from my question above you can see that I am everything else than a color expert. 😊 So @LeaVerou, when you say Sebastian |
See, that's precisely what I’m worried about. No, it's not a shortcut for Note that |
My only real argument for maintaining HWB is that color pickers in many applications continue to use it as their input form, which suggests it continues to have some use. Chrome at some point switched to an HSL-ish form for
Valid. I wouldn't be too put out removing HWB, due to this precise reasoning.
Not really, at least for the case HWB is for. LCH and HSL are identical in terms of ease of creation/manipulation, and manipulating colors in HSL being kinda tricky is exactly why HWB exists; it's (reasonably, imo) argued that the lightness/saturation(chroma) plane is harder to work with, mentally, than the HWB triangle. color-mix() isn't a substitute for readability/authorability, either, because you have to stack two of them together and it's way longer as a result. It is indeed easy to generate tints and shades from a base color out of it, which isn't what HWB was for anyway. (HWB made it reasonably easy to manually generate tints and shades of a base color that was already expressed in HWB, but had no ability to manipulate arbitrary colors.)
Kinda sorta (see first paragraph) - the HWB mental model appears to still be used in quite a bit of tooling (but so is the HSL mental model)
I don't understand what you mean by this. The older of these issues is about both HSL and HWB, so you either can't close it (because it's unanswered for HSL) or can (because it's answered for both). The more recent one, about commas, was originally asked purely about HWB, but is also in fact about multiple color functions (all the recent ones), so again either we can close it because it's answered for everyone, or we can't close it because it's not answered for any of them. We have no open issues actually about the hwb() function itself, such that removing it would let us auto-close anything. |
Sure, but if you specify
What I wrote was total nonsense. My question was rather, how to express e.g. Sebastian |
A triangle with black at the bottom, white at the top, and the most saturated/high chroma color of a given hue as the third corner is a natural representation of a constant-hue slice through a color gamut. Perceptual representations will have varying shaped triangles (and may have curved edges) while not-really-perceptual ones will go for a regular isosceles triangle. There are several examples n the spec already, such as Given a constant-hue presentation, there then needs to be a separate means to select the hue and a circle is the natural way to indicate this. Which is to say that
Not really, and the spec already makes that very clear:
|
Those issues are close to being closed anyway; the commas in HWB one is just waiting for me to add wording about all the other commaless syntaxes not having an equivalent with-commas form, but the spec is already explicit about HWB not allowing commas and WPT tests are already updated to reflect that. |
Hm, my point is that the "rectangle" view is an accurate representation of the coordinate space - for a given hue, you can specify colors in the (high chroma, high lightness) and (high chroma, low lightness) corners. HSL actually treats these colors as meaningful, which is nonsense, of course, but it does make for a very simple way to represent the coordinates, and that's equally true for LCH (it just doesn't pretend those colors outside the triangle-ish area are real). The triangle only arises by specially marking the out-of-gamut colors; they're still possible to specify. I suppose technically HWB's equal-hue slices are the same if you were to just map them to a square with W/B axises, but it feels like that's not a natural interpretation of the coordinates; for one, it puts the pure hue off in a corner. The triangle, representing weights of the three colors (or equivalently, with the altitude from the hue-corner representing w+b %, and then perpendicular distance representing w% vs b% balance), represents it well; it omits some values you can technically specify, but only redundant ones that can be specified in other ways.
In the sense I am meaning, yes really - both of them model colors with the "saturation(chroma) + lightness" model; the entire point of HWB is the assertion that this isn't a very natural model to think in, and that "hue + white + black" is more natural. I'm well aware of the differences between HSL and LCH and why LCH is a marked improvement, but those differences aren't relevant to what I was saying. Again, I know that HWB is a non-perceptual space; it's just a recasting of HSL, which is just a recasting of RGB. I'm not defending it on those grounds; that would be silly. I'm just pointing out that it does have reasons to exist, which aren't met by the other new color functions. |
@LeaVerou wrote:
True, But so is |
I'm not hearing a compelling reason to remove @tabatkins is Blink expected to show up in Blink at some point? I couldn't find a bug for it. Given two independent implementations in browsers, there is n reason to put it at-risk and I am inclined to just leave it as-is with no spec change. |
I've filed one now: https://crbug.com/1288883 Sebastian |
lol, I wonder what that one page that's using hwb() is. |
Given no objections, and also evidence that Blink is implementing |
hwb()
was added to CSS Color over 8 years ago, when we still thought sRGB-only formats and manually tweaking components to create variations were the way to go. The theory was that because its two non-hue components are whiteness and blackness, it would make it easier to create tints and shades of colors.After going unimplemented for 8 years, it was now implemented in Gecko and WebKit alongside other things in Color 4, but its usage on the web is still 0, so there is no web compat risk in removing it.
Here’s why I think we should remove it:
color-mix()
is far superior for creating tints and shades (mixes with white and black) of any existing color.So let's kill it with fire! 🔥🔥🔥 Who's with me? 😃
The text was updated successfully, but these errors were encountered: