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

scale-color() produces incorrect colors #2903

Closed
nex3 opened this issue May 31, 2019 · 1 comment · Fixed by #2954
Closed

scale-color() produces incorrect colors #2903

nex3 opened this issue May 31, 2019 · 1 comment · Fixed by #2954
Labels
Compatibility - P2 Moderately important for compatibility with the Sass spec and ecosystem

Comments

@nex3
Copy link
Contributor

nex3 commented May 31, 2019

LibSass's scale-color() function output doesn't match that of Dart Sass or Ruby Sass in a number of cases:

scale-color(turquoise, $saturation: 24%, $lightness: -48%)
  should be #10867a, is actually #0d897c
scale-color(plum, $saturation: 67%)
  should be #f489f4, is actually #e895e8
scale-color(plum, $saturation: 100%)
  should be #ff7eff, is actually #ed90ed

There are likely other cases that are invalid as well.

@nex3 nex3 added the Compatibility - P2 Moderately important for compatibility with the Sass spec and ecosystem label Jun 3, 2019
@zwass
Copy link
Contributor

zwass commented Jul 23, 2019

This seems to be due to

if (sscale) c->s(c->s() + sscale * (sscale > 0.0 ? 100.0 - c->l() : c->s()));
incorrectly using luminance rather than saturation in the ternary.

zwass added a commit to zwass/libsass that referenced this issue Jul 23, 2019
The ternary operator incorrectly selected the luminance value when it
should have used the saturation. With this fix, the returned values are
as expected per the issue.

Fixes sass#2903.
xzyfer pushed a commit that referenced this issue Jul 23, 2019
The ternary operator incorrectly selected the luminance value when it
should have used the saturation. With this fix, the returned values are
as expected per the issue.

Fixes #2903.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compatibility - P2 Moderately important for compatibility with the Sass spec and ecosystem
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants