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

Why saturation changes grey color? #612

Closed
firedev opened this issue Dec 30, 2012 · 1 comment
Closed

Why saturation changes grey color? #612

firedev opened this issue Dec 30, 2012 · 1 comment

Comments

@firedev
Copy link

firedev commented Dec 30, 2012

scale_color(#888, $saturation:10%)
#947c7c   // Red hue

Should be

scale_color(#888, $saturation:10%)
#888888

You can check in Photoshop.

@nex3
Copy link
Contributor

nex3 commented Jan 2, 2013

For each color, Sass keeps track of its hue, saturation, and lightness. Even when a color is completely grayscale, it still has a hue component so that should it ever be resaturated, it retains its original color. We want scale-color(scale-color($color, $saturation: -100%), $saturation: 100%) to be the same as scale-color($color, $saturation: 100%).

This raises the question of what happens when you try to saturate a color that was originally grayscale. It has no original hue, so we have to choose one arbitrarily. We end up choosing red, since that's hue 0.

We could have some sort of "originally-grayscale" flag that we keep track of for each color which indicates that it can't have its saturation increased, but that raises a bunch of issues of its own. It means that scale-color($color, $saturation: 10%) may or may not return a color with increased saturation, depending on how $color was created. It would also mean that change-color(saturate($color, 10%), $hue: 120deg) is no longer always equivalent to saturate(change-color($color, $hue: 120deg), 10%).

tl;dr

There's a bunch of desired behaviors color function that can't all work simultaneously. In this case, "work exactly like Photoshop" gave way in favor of other behaviors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants