[Color 4] Update tests for color.mix() and color.complement()#1843
[Color 4] Update tests for color.mix() and color.complement()#1843nex3 merged 34 commits intosass:feature.color-4from
Conversation
| a {b: mix(red, lch(20% -20 0))} | ||
|
|
||
| <===> null_method/non_legacy/color2/error | ||
| Error: $color1: To use color.mix() with non-legacy color red, you must provide a $method. |
There was a problem hiding this comment.
$color2 should be the cause of the error here, right?
nex3
left a comment
There was a problem hiding this comment.
If you add physical directories for spec/core_functions/color/mix, you'll need to delete mix.hrx—otherwise the test runner won't know which is the real one and will throw an error.
|
|
||
| <===> specified/output.css | ||
| a { | ||
| b: rgb(145, 116, 0); |
There was a problem hiding this comment.
Dart Sass returns rgb(145.2072868242, 115.9916273156, -48.1699603699) here. Is it possible that the source of truth you're using is clamping the RGB channels?
There was a problem hiding this comment.
Is it possible that the source of truth you're using is clamping the RGB channels?
Correct. I've updated the places where my source of truth isn't as precise. I'll keep an eye out on these going forward.
There was a problem hiding this comment.
Looks like this still has a non-negative blue channel. Should I just go ahead and update it with Dart Sass's output?
There was a problem hiding this comment.
updated with Dart Sass's output.
|
|
||
| <===> rgb_explicit_method/output.css | ||
| a { | ||
| b: color(display-p3 0.9 0.93 0.3); |
There was a problem hiding this comment.
Dart Sass returns color(display-p3 0.9849707148 0.9141322646 0.3079881122) here, which is kind of close but still surprisingly divergent given that. Do you know which one is correct?
There was a problem hiding this comment.
I will have to look more into this but I think the Dart Sass version is correct. This mix comes out to color(display-p3 0.8959 0.9307 0.3031) on the ColorJS playground and then gets rounded up it seems. Like you said, all surprisingly different!
There was a problem hiding this comment.
The Dart Sass output is the correct one here.
|
|
||
| <===> xyz_explicit_method/output.css | ||
| a { | ||
| b: color(xyz-d50 0.3 0.21 0.02); |
There was a problem hiding this comment.
Another close but weirdly different output: color(xyz-d50 0.3464867621 0.2923393699 0.0410088495)
There was a problem hiding this comment.
fixed the precision to match Dart Sass here.
| - dart-sass | ||
|
|
||
| <===> error/null_space/non_legacy/input.scss | ||
| a {b: complement(oklch(0.63 0.26 29.2))} |
There was a problem hiding this comment.
This test should fail since it doesn't provide an interpolation space but it passes, outputting: oklch(0.8967656043 0.1522729881 196.7205341356deg);
| :ignore_for: | ||
| - libsass | ||
| :todo: | ||
| - dart-sass |
There was a problem hiding this comment.
I think you have noted this in the wip dart sass PR. I marked this one as to do as well.
| - dart-sass | ||
|
|
||
| <===> rectangular_space/input.scss | ||
| a {b: mix(red, blue, $method: oklab)} |
There was a problem hiding this comment.
Why is this expected to be an error?
There was a problem hiding this comment.
This was mistakenly added as an error. I momentarily mixed up which interpolation spaces are valid here, thinking I was working on color.complement()
|
|
||
| <===> specified/output.css | ||
| a { | ||
| b: rgb(145, 116, 0); |
There was a problem hiding this comment.
Looks like this still has a non-negative blue channel. Should I just go ahead and update it with Dart Sass's output?
|
|
||
| <===> contradiction/output.css | ||
| a { | ||
| b: rgba(0, 0, 0, 0); |
There was a problem hiding this comment.
I think this was changed back to rgba(0, 0, 0, 0). Should it still be transparent? @nex3
There was a problem hiding this comment.
rgba(0, 0, 0, 0) matches the existing output here. If I recall, we chose to emit this instead of transparent because that keyword had some weird behavior in very old IE versions.
|
I think we should be able to get these tests passing if we merge |
Part of new/updated tests for color spaces.
See: sass/sass#2831
[skip dart-sass]