Skip to content
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 JS API color.interpolate(color2) without options #2369

Merged
merged 3 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
selector, regardless of which selector they came from. Previously, this
reordering only applied to pseudo-selectors in the second selector.

### JS API

* Fix `SassColor.interpolate()` to allow an undefined `options` parameter, as
the types indicate.

### Embedded Sass

* Properly pass missing color channel values to and from custom functions.
Expand Down
8 changes: 4 additions & 4 deletions lib/src/js/value/color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ final JSClass colorClass = () {

return changedColor.toSpace(self.space);
},
'interpolate':
(SassColor self, SassColor color2, _InterpolationOptions options) {
'interpolate': (SassColor self, SassColor color2,
[_InterpolationOptions? options]) {
InterpolationMethod interpolationMethod;

if (options.method case var method?) {
if (options?.method case var method?) {
var hue = HueInterpolationMethod.values.byName(method);
interpolationMethod = InterpolationMethod(self.space, hue);
} else if (!self.space.isPolar) {
Expand All @@ -322,7 +322,7 @@ final JSClass colorClass = () {
}

return self.interpolate(color2, interpolationMethod,
weight: options.weight);
weight: options?.weight);
}
});

Expand Down