diff options
| author | Mark Otto <[email protected]> | 2017-06-15 11:15:48 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2017-06-15 11:15:48 -0700 |
| commit | c31d52499811d5c68d122db806ce27a112b489bd (patch) | |
| tree | ae0040c5b8c67fa13ccfa2db460a7226576422ca | |
| parent | 516af795094605a2771c221c9e8b4894a758a455 (diff) | |
| download | bootstrap-c31d52499811d5c68d122db806ce27a112b489bd.tar.xz bootstrap-c31d52499811d5c68d122db806ce27a112b489bd.zip | |
add color contrast and map-get functions
| -rw-r--r-- | scss/_functions.scss | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scss/_functions.scss b/scss/_functions.scss index 5aa9f6620..6c85bbd4e 100644 --- a/scss/_functions.scss +++ b/scss/_functions.scss @@ -47,3 +47,26 @@ @return $string; } + +// Color contrast +@mixin color-yiq($color) { + $r: red($color); + $g: green($color); + $b: blue($color); + + $yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000; + + @if ($yiq >= 128) { + color: #111; + } @else { + color: #fff; + } +} + +// Retreive color Sass maps +@function color($key: "blue") { + @return map-get($colors, $key); +} +@function theme-color($key: "primary") { + @return map-get($theme-colors, $key); +} |
