aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwastek <[email protected]>2017-09-26 14:05:59 +0200
committerXhmikosR <[email protected]>2017-09-26 15:05:59 +0300
commit17fd2c9f84be84fb917f40212d2ddd88fe6a6d1e (patch)
tree17436f7f522845adfb13fd666cca9fb79e1ffa59
parentf615f372e528d443f9f179451d00a4b960fc8a67 (diff)
downloadbootstrap-17fd2c9f84be84fb917f40212d2ddd88fe6a6d1e.tar.xz
bootstrap-17fd2c9f84be84fb917f40212d2ddd88fe6a6d1e.zip
Improve theme-color-level() using abs() (#24074)
`abs()` gets the absolute value of `$level`. That way, `if/else` statement can be completely eliminated.
-rw-r--r--scss/_functions.scss8
1 files changed, 2 insertions, 6 deletions
diff --git a/scss/_functions.scss b/scss/_functions.scss
index a63680aa5..5d43b5708 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);
}