-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Fix hue related mix issues #338
Conversation
- The color.js API states that mix takes the same arguments as `range` but all options were not getting passed, `hue` being an example. - Clarification about the CSS spec mentions that when interpolating an undefined hue and defined hue that the undefined handling should be done before hue fix-up which would create both a shorter and longer arc between an undefined and defined hue. w3c/csswg-drafts#9436 (comment)
This ensures that we get the proper longer hue when mixing and interpolating: > new Color("hsl(90deg 50% 50%)").mix('hsl(none 50% 50%)', {space: 'hsl', hue: 'longer'});
Color {
space: <ref *1> ColorSpace {
id: 'hsl',
name: 'HSL',
base: RGBColorSpace {
id: 'srgb',
name: 'sRGB',
base: [RGBColorSpace],
aliases: undefined,
fromBase: [Function: fromBase],
toBase: [Function: toBase],
coords: [Object],
white: [Array],
formats: [Object],
referred: 'display',
path: [Array]
},
aliases: undefined,
fromBase: [Function: fromBase],
toBase: [Function: toBase],
coords: { h: [Object], s: [Object], l: [Object] },
white: [ 0.9504559270516716, 1, 1.0890577507598784 ],
formats: { hsl: [Object], hsla: [Object] },
referred: undefined,
path: [ [ColorSpace], [RGBColorSpace], [RGBColorSpace], [Circular *1] ]
},
coords: [ 270, 50, 50 ],
alpha: 1
} |
I will note, that I had to use As this is a separate issue, one I am not as familiar with, I am deferring the root cause of the typed issues to someone who knows better. After hue adjustment, they were normalized to basic floats anyway, so forcing them to pure floats so we could check their |
Hey, thanks for working on this!
Could you elaborate on what these objects were? |
To be honest, I do not know exactly what they are. I was trying to avoid spiraling down a rabbit hole requiring me to fix bug after bug, so I specifically focused on the issue I was trying to fix. But I did log the object when I saw the console.log(θ1, θ2) [Number: 90] { type: '<angle>', unit: 'deg', raw: '90deg' } [Number: NaN] { none: true, raw: 'none' } I don't know what they are, but they can be cast to pure floats. |
I'll try out the |
Okay, this was just my inexperience with dealing with |
They are just |
Thanks for the info! I researched them after you posted about them and have already resolved the issue in the latest push. |
Merged, thanks! |
@facelessuser Does this PR fix #57? |
@jamesnw, I believe so. I forgot I opened that issue 3 years ago 🙃. |
range
but all options were not getting passed,hue
being an example.