@@ -630,10 +630,11 @@ Value _invert(List<Value> arguments, {bool global = false}) {
630
630
_checkPercent (weightNumber, "weight" );
631
631
var rgb = color.toSpace (ColorSpace .rgb);
632
632
return _mixLegacy (
633
- SassColor .rgb (255.0 - rgb.channel0, 255.0 - rgb.channel1,
634
- 255.0 - rgb.channel2, color.alphaOrNull),
635
- color,
636
- weightNumber);
633
+ SassColor .rgb (255.0 - rgb.channel0, 255.0 - rgb.channel1,
634
+ 255.0 - rgb.channel2, color.alphaOrNull),
635
+ color,
636
+ weightNumber)
637
+ .toSpace (color.space);
637
638
}
638
639
639
640
var space = ColorSpace .fromName (
@@ -668,7 +669,7 @@ Value _invert(List<Value> arguments, {bool global = false}) {
668
669
_ => throw UnsupportedError ("Unknown color space $space ." )
669
670
};
670
671
671
- if (fuzzyEquals (weight, 1 )) return inverted;
672
+ if (fuzzyEquals (weight, 1 )) return inverted. toSpace (color.space) ;
672
673
return color.interpolate (inverted, InterpolationMethod (space),
673
674
weight: 1 - weight);
674
675
}
@@ -1144,10 +1145,10 @@ SassColor _mixLegacy(SassColor color1, SassColor color2, SassNumber weight) {
1144
1145
var weight2 = 1 - weight1;
1145
1146
1146
1147
return SassColor .rgb (
1147
- fuzzyRound ( rgb1.channel0 * weight1 + rgb2.channel0 * weight2) ,
1148
- fuzzyRound (color1.green * weight1 + color2.green * weight2) ,
1149
- fuzzyRound (color1.blue * weight1 + color2.blue * weight2) ,
1150
- color1 .alpha * weightScale + color2 .alpha * (1 - weightScale));
1148
+ rgb1.channel0 * weight1 + rgb2.channel0 * weight2,
1149
+ rgb1.channel1 * weight1 + rgb2.channel1 * weight2,
1150
+ rgb1.channel2 * weight1 + rgb2.channel2 * weight2,
1151
+ rgb1 .alpha * weightScale + rgb2 .alpha * (1 - weightScale));
1151
1152
}
1152
1153
1153
1154
/// The definition of the `opacify()` and `fade-in()` functions.
0 commit comments