Re: [csswg-drafts] [css-color-5] When mixing hue, there are two ways round the hue range (#4735)

Two comments on the pseudo-javascript in the [Hue interpolation](https://drafts.csswg.org/css-color-5/#hue-interpolation) section:

First, [above](https://github.com/w3c/csswg-drafts/issues/4735#issuecomment-635741840) you wrote:
```js
// angle1, angle2 are hue angles in degrees
angle1 = ((angle1 % 360) + 360) % 360; // constrain to [0, 360)
angle2 = ((angle1 % 360) + 360) % 360; // constrain to [0, 360)
```
I think it would be good to include this explicitly in the definitions of `shorter`, `longer`, `increasing`, and `decreasing`, both since I *think* that's the intent, and I *think* it's the intent that it *not* be done for `specified`.

Second, I think the pseudo-code for `longer` is incorrect.  For example, it adjusts θ₁=315 and θ₂=45 using the first conditional branch into θ₂=405 and θ₁=315, when I think it should be left untouched.  I think the code should instead be (in addition to the change in my first comment):
```js
if (θ₂ > θ₁ && θ₂ - θ₁ < 180) {
  θ₁ += 360;
}
else if (θ₁ > θ₂ && θ₁ - θ₂ < 180) {
  θ₂ += 360;
}
```

-- 
GitHub Notification of comment by dbaron
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4735#issuecomment-649803016 using your GitHub account

Received on Thursday, 25 June 2020 20:33:24 UTC