blackness and lightness vs sass darken lighten
See original GitHub issueI am trying to replicate the results of the sass darken
and lighten
functions using the css color function, however, I am not getting similar results:
/* color-function */
color(#B6FFD4 blackness(30%)) /* #b3b3b3 */
/* sass darken */
darken(#B6FFD4, 30%) /* #1dff7a */
Basically I want a stronger green, which is what I get using sass darken, but I can’t figure out how to replicate those results. Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
sass:color
Returns a gray color with the same lightness as $color . This is identical to color.change($color, $saturation: 0%) . SCSS; Sass ...
Read more >Sass lighten() and darken() vs mix() using black and white
Sass has color function to lighten and darken colors, but these don't always behave the way you might expect. Using mix() with black...
Read more >Using lighten() and darken() in SASS - Falkus.co
As the names suggest, given a colour and percentage, these functions will return a colour lighter or darker respectively.
Read more >Sass Color Functions - TutorialsTeacher
The last component, value, is a measure of the lightness or darkness of a color. Think of a tree with some of its...
Read more >Controlling color with Sass color functions - Thoughtbot
Darken & Lighten ... These two adjust the Lightness of the color's HSL values. Sass will parse our hex color variable to hsl,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@perrin4869 Yes, right, SASS
darken
&lighten
just change a lightness of color. You can see this with color in HSL (last argument of hsl-color specifies a lightness):lightness
make the same thing.Action of
blackness
you can imagine as a change of blackness argument in HWB-colorshwb(hue, whiteness %, blackness %)
.@IvanVS I’ve been playing around just now with the functions some more, got some interesting results.
The closest I’ve been able to get to SASS
darken
function was to uselightness(-15%)
.blackness
goes the opposite way of what I am trying to achieve. Saturation barely seems to change the color, and it doesn’t matter if I use +,-, or just percentage, it is always in the opposite direction of what I want (red, blue to drop, green to remain 255).I would say that based on my tests, the closest to sass
darken
is to dolightness(-%)
, andlighten
,lightness(+%)
I can’t really figure out whan
blackness
is trying to do, and it almost seems as though adarkness
function is missing…