Skip to content
Open
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.98.0

* **Potentially breaking CSS compatibility fix:** In keeping with the latest CSS
specification, this release changes the algorithm for converting colors to and
from the `rec2020` color space. This now uses the EOTF algorithm with a gamma
of 2.4.

## 1.97.3

* Fix a bug where nesting an at-rule within multiple style rules in plain CSS
Expand Down
26 changes: 6 additions & 20 deletions lib/src/value/color/space/rec2020.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import '../conversions.dart';
import '../space.dart';
import 'utils.dart';

/// A constant used in the rec2020 gamma encoding/decoding functions.
const _alpha = 1.09929682680944;

/// A constant used in the rec2020 gamma encoding/decoding functions.
const _beta = 0.018053968510807;

/// The rec2020 color space.
///
/// https://www.w3.org/TR/css-color-4/#predefined-rec2020
Expand All @@ -29,22 +23,14 @@ final class Rec2020ColorSpace extends ColorSpace {
const Rec2020ColorSpace() : super('rec2020', rgbChannels);

@protected
double toLinear(double channel) {
// Algorithm from https://www.w3.org/TR/css-color-4/#color-conversion-code
var abs = channel.abs();
return abs < _beta * 4.5
? channel / 4.5
: channel.sign * (math.pow((abs + _alpha - 1) / _alpha, 1 / 0.45));
}
double toLinear(double channel) =>
// Algorithm from https://drafts.csswg.org/css-color-4/#color-conversion-code
channel.sign * math.pow(channel.abs(), 2.4);

@protected
double fromLinear(double channel) {
// Algorithm from https://www.w3.org/TR/css-color-4/#color-conversion-code
var abs = channel.abs();
return abs > _beta
? channel.sign * (_alpha * math.pow(abs, 0.45) - (_alpha - 1))
: 4.5 * channel;
}
double fromLinear(double channel) =>
// Algorithm from https://drafts.csswg.org/css-color-4/#color-conversion-code
channel.sign * math.pow(channel.abs(), 1 / 2.4);

@protected
Float64List transformationMatrix(ColorSpace dest) => switch (dest) {
Expand Down
4 changes: 4 additions & 0 deletions pkg/sass-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.43

* No user-visible changes.

## 0.4.42

* No user-visible changes.
Expand Down
2 changes: 1 addition & 1 deletion pkg/sass-parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sass-parser",
"version": "0.4.42",
"version": "0.4.43",
"description": "A PostCSS-compatible wrapper of the official Sass parser",
"repository": "sass/dart-sass",
"author": "Google Inc.",
Expand Down
4 changes: 4 additions & 0 deletions pkg/sass_api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 17.4.0

* No user-visible changes.

## 17.3.3

* No user-visible changes.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sass_api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: sass_api
# Note: Every time we add a new Sass AST node, we need to bump the *major*
# version because it's a breaking change for anyone who's implementing the
# visitor interface(s).
version: 17.3.3
version: 17.4.0
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass

environment:
sdk: ">=3.6.0 <4.0.0"

dependencies:
sass: 1.97.3
sass: 1.98.0

dev_dependencies:
dartdoc: ">=8.0.14 <10.0.0"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sass
version: 1.97.3
version: 1.98.0
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down