1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-30 00:29:52 +02:00

add theme-color-level function and interval so we can generate shades of colors

This commit is contained in:
Mark Otto
2017-06-25 18:31:03 -07:00
parent 9372eef9e1
commit 6c595d2cc1
2 changed files with 16 additions and 0 deletions

View File

@@ -67,6 +67,20 @@
@function color($key: "blue") {
@return map-get($colors, $key);
}
@function theme-color($key: "primary") {
@return map-get($theme-colors, $key);
}
// Request a theme color level
@function theme-color-level($color-name: "primary", $level: 0) {
$color: theme-color($color-name);
$color-base: if($level > 0, #000, #fff);
@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);
}
}