Skip to content

Commit 5535d1f

Browse files
ntkmenex3
andauthored
Fix srgb to linear (#2372)
Co-authored-by: Natalie Weizenbaum <[email protected]>
1 parent 5acae8a commit 5535d1f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

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

13+
* Fix a slight inaccuracy case when converting to `srgb-linear` and
14+
`display-p3`.
15+
1316
### JS API
1417

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

lib/src/value/color/space/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ double hueToRgb(double m1, double m2, double hue) {
5252
double srgbAndDisplayP3ToLinear(double channel) {
5353
// Algorithm from https://www.w3.org/TR/css-color-4/#color-conversion-code
5454
var abs = channel.abs();
55-
return abs < 0.04045
55+
return abs <= 0.04045
5656
? channel / 12.92
5757
: channel.sign * math.pow((abs + 0.055) / 1.055, 2.4);
5858
}

0 commit comments

Comments
 (0)