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

@tab wrote:

> Once the spec is fixed to not mod the angle eagerly, the consistent answer is to just do a linear interpolation from the start to the end angle. If you want a particular direction, you can specify the angles to cause that direction, just like you do with 'rotate'

Suppose I have 

```
--start: `lch(52% 58.1 22.7) 
--end: lch(56% 49.1 257.1)

// currently, this goes the long way around
mix-color(var(--start) var(--end) hue(75.23%));

// 22.7 * 0.7523 + -102.9 * ( 1 - 0.7523 ) = -8.41112
// mixed result is lch(52% 58.1 -8.41112)
```

You seem to be saying that going the other way round I would need to inspect the values of the two custom properties and if needed, add or subtract 360 to make it do what I want.

```
--otherend: lch(56% 49.1 -102.9)

// now it goes the short way around
mix-color(var(--start) var(--otherend) hue(75.23%));
```

while what I am suggesting does not require making adjusted copies of custom properties:

```
// this would go the short way around
mix-color(var(--start) var(--end) hue(75.23% short));
// this would go the long way around
mix-color(var(--start) var(--end) hue(75.23% long));
// new default if unspecified, go the short way around
mix-color(var(--start) var(--end) hue(75.23%));
````

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

Received on Wednesday, 11 March 2020 14:35:53 UTC