Skip to content

Commit

Permalink
Fix JS API color.interpolate(color2) without options (#2369)
Browse files Browse the repository at this point in the history
Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
  • Loading branch information
ntkme and nex3 authored Oct 1, 2024
1 parent 4890989 commit 5acae8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
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

0 comments on commit 5acae8a

Please sign in to comment.