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 srgb to linear #2372

Merged
merged 2 commits into from
Oct 2, 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
selector, regardless of which selector they came from. Previously, this
reordering only applied to pseudo-selectors in the second selector.

* Fix a slight inaccuracy case when converting to `srgb-linear` and
`display-p3`.

### JS API

* Fix `SassColor.interpolate()` to allow an undefined `options` parameter, as
Expand Down
2 changes: 1 addition & 1 deletion lib/src/value/color/space/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ double hueToRgb(double m1, double m2, double hue) {
double srgbAndDisplayP3ToLinear(double channel) {
// Algorithm from https://www.w3.org/TR/css-color-4/#color-conversion-code
var abs = channel.abs();
return abs < 0.04045
return abs <= 0.04045
? channel / 12.92
: channel.sign * math.pow((abs + 0.055) / 1.055, 2.4);
}
Expand Down