[csswg-drafts] [css-color-4] Hue "longer" handling when hues resolve to the same (#7147)

facelessuser has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color-4] Hue "longer" handling when hues resolve to the same ==
A discrepancy with "longer" hue handling was noticed in [Color.js](https://github.com/LeaVerou/color.js/pull/136) regarding its hue handling and the CSS spec.  The conversation seemed to converge on the CSS specification maybe not handling this case correctly.

The current spec specifies longer as this:

```js
if (0 < θ₂ - θ₁ < 180) {
  θ₁ += 360;
}
else if (-180 < θ₂ - θ₁ < 0) {
  θ₂ += 360;
}
```

This seems to work fine in all cases except when θ₁ and  θ₂  end up being identical. Cases like with `0deg` and `360deg` or `180deg` and `540deg`.

During discussions, it seems that maybe these cases were not being handled correctly. It also seems that a more descriptive approach as to the intent is needed as well to clear up confusion:

> [svgeesus](https://github.com/svgeesus) commented [21 hours ago]https://github.com/LeaVerou/color.js/pull/136#issuecomment-1068347952)
> I think an issue should be raised on CSS Color 4:
>
> - each hue fixup method should have a textual description, not just a bunch of mathematics, and
> - the longer one has no reason for a discontinuity. The result is either 0, or it is 180 to 359.9999 which makes no sense as being the "longer" way round. Instead it should be 180 to 360.



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7147 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 16 March 2022 16:17:56 UTC