Skip to content

Commit 5acae8a

Browse files
ntkmenex3
andauthored
Fix JS API color.interpolate(color2) without options (#2369)
Co-authored-by: Natalie Weizenbaum <[email protected]>
1 parent 4890989 commit 5acae8a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
selector, regardless of which selector they came from. Previously, this
1111
reordering only applied to pseudo-selectors in the second selector.
1212

13+
### JS API
14+
15+
* Fix `SassColor.interpolate()` to allow an undefined `options` parameter, as
16+
the types indicate.
17+
1318
### Embedded Sass
1419

1520
* Properly pass missing color channel values to and from custom functions.

lib/src/js/value/color.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,11 @@ final JSClass colorClass = () {
307307

308308
return changedColor.toSpace(self.space);
309309
},
310-
'interpolate':
311-
(SassColor self, SassColor color2, _InterpolationOptions options) {
310+
'interpolate': (SassColor self, SassColor color2,
311+
[_InterpolationOptions? options]) {
312312
InterpolationMethod interpolationMethod;
313313

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

324324
return self.interpolate(color2, interpolationMethod,
325-
weight: options.weight);
325+
weight: options?.weight);
326326
}
327327
});
328328

0 commit comments

Comments
 (0)