From: schwastek <31923722+schwastek@users.noreply.github.com> Date: Tue, 26 Sep 2017 12:05:59 +0000 (+0200) Subject: Improve theme-color-level() using abs() (#24074) X-Git-Tag: v4.0.0-beta.2~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17fd2c9f84be84fb917f40212d2ddd88fe6a6d1e;p=thirdparty%2Fbootstrap.git Improve theme-color-level() using abs() (#24074) `abs()` gets the absolute value of `$level`. That way, `if/else` statement can be completely eliminated. --- diff --git a/scss/_functions.scss b/scss/_functions.scss index a63680aa5c..5d43b57087 100644 --- a/scss/_functions.scss +++ b/scss/_functions.scss @@ -80,11 +80,7 @@ @function theme-color-level($color-name: "primary", $level: 0) { $color: theme-color($color-name); $color-base: if($level > 0, #000, #fff); + $level: abs($level); - @if $level < 0 { - // Lighter values need a quick double negative for the Sass math to work - @return mix($color-base, $color, $level * -1 * $theme-color-interval); - } @else { - @return mix($color-base, $color, $level * $theme-color-interval); - } + @return mix($color-base, $color, $level * $theme-color-interval); }