aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgijsbotje <[email protected]>2017-09-13 17:32:44 +0200
committergijsbotje <[email protected]>2017-09-13 17:32:44 +0200
commitcc092272eefa0e89bebfc716c8df8214d2804c77 (patch)
treed0197492c2d344982651a4c5dfe49ed95b15a94f
parentcf004433e0312482a8c4918d559f38c19a3e14d9 (diff)
downloadbootstrap-cc092272eefa0e89bebfc716c8df8214d2804c77.tar.xz
bootstrap-cc092272eefa0e89bebfc716c8df8214d2804c77.zip
modified the yiq to to an actual function
function only returns a value, not the attribute itself updated every use of the former mixin to use the new function
-rw-r--r--assets/scss/_colors.scss6
-rw-r--r--scss/_functions.scss6
-rw-r--r--scss/mixins/_badge.scss4
-rw-r--r--scss/mixins/_buttons.scss4
4 files changed, 10 insertions, 10 deletions
diff --git a/assets/scss/_colors.scss b/assets/scss/_colors.scss
index d09d3a2c5..8d2825c57 100644
--- a/assets/scss/_colors.scss
+++ b/assets/scss/_colors.scss
@@ -4,21 +4,21 @@
@each $color, $value in $colors {
.swatch-#{$color} {
+ color: color-yiq($value);
background-color: #{$value};
- @include color-yiq($value);
}
}
@each $color, $value in $theme-colors {
.swatch-#{$color} {
+ color: color-yiq($value);
background-color: #{$value};
- @include color-yiq($value);
}
}
@each $color, $value in $grays {
.swatch-#{$color} {
+ color: color-yiq($value);
background-color: #{$value};
- @include color-yiq($value);
}
}
diff --git a/scss/_functions.scss b/scss/_functions.scss
index a63680aa5..bbb015d07 100644
--- a/scss/_functions.scss
+++ b/scss/_functions.scss
@@ -49,7 +49,7 @@
}
// Color contrast
-@mixin color-yiq($color) {
+@function color-yiq($color) {
$r: red($color);
$g: green($color);
$b: blue($color);
@@ -57,9 +57,9 @@
$yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
@if ($yiq >= 150) {
- color: #111;
+ @return #111;
} @else {
- color: #fff;
+ @return #fff;
}
}
diff --git a/scss/mixins/_badge.scss b/scss/mixins/_badge.scss
index 257a6abb7..c1caafe48 100644
--- a/scss/mixins/_badge.scss
+++ b/scss/mixins/_badge.scss
@@ -1,11 +1,11 @@
@mixin badge-variant($bg) {
- @include color-yiq($bg);
+ color: color-yiq($bg);
background-color: $bg;
&[href] {
@include hover-focus {
- @include color-yiq($bg);
text-decoration: none;
+ color: color-yiq($bg);
background-color: darken($bg, 10%);
}
}
diff --git a/scss/mixins/_buttons.scss b/scss/mixins/_buttons.scss
index 44ce4f72e..ef623ccd5 100644
--- a/scss/mixins/_buttons.scss
+++ b/scss/mixins/_buttons.scss
@@ -4,13 +4,13 @@
// and disabled options for all buttons
@mixin button-variant($background, $border, $active-background: darken($background, 7.5%), $active-border: darken($border, 10%)) {
- @include color-yiq($background);
+ color: color-yiq($background);
background-color: $background;
border-color: $border;
@include box-shadow($btn-box-shadow);
@include hover {
- @include color-yiq($active-background);
+ color: color-yiq($active-background);
background-color: $active-background;
border-color: $active-border;
}