W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2020

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

From: L. David Baron via GitHub <sysbot+gh@w3.org>
Date: Thu, 25 Jun 2020 20:33:23 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-649803016-1593117201-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:28 UTC