Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sass colour lighten function - Using %

Tags:

css

sass

As far as I know Sass lighten function works like this:

lighten($myColour, 20%);

But if you look at this online tool for creating colours:

enter link description here

It creates them as follow without the %:

lighten($myColour, 20);

Is this OK? Does it make any difference using 20 or 20% ?

Thanks

like image 250
question Avatar asked Sep 17 '26 03:09

question


1 Answers

As mentioned in the Sass documentation, the function lighten is said:

lighten($color, $amount)

where

$amount (Sass::Script::Value::Number) — The amount to increase the lightness by, between 0% and 100%

So it can be both. I tested it in this CodePen example and it gave both the same hex value of color.

.lighten-number {
  color: lighten(red, 20);
}

.lighten-percentage {
  color: lighten(red, 20%);
}
like image 104
Roy Avatar answered Sep 18 '26 17:09

Roy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!