1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-25 04:12:55 +01:00

Merge branch 'yiq-function-update' of https://github.com/gijsbotje/bootstrap into v4-dev

This commit is contained in:
Mark Otto 2017-10-17 17:29:15 -07:00
commit 8a98bfd8c9
4 changed files with 10 additions and 10 deletions

View File

@ -4,21 +4,21 @@
@each $color, $value in $colors { @each $color, $value in $colors {
.swatch-#{$color} { .swatch-#{$color} {
color: color-yiq($value);
background-color: #{$value}; background-color: #{$value};
@include color-yiq($value);
} }
} }
@each $color, $value in $theme-colors { @each $color, $value in $theme-colors {
.swatch-#{$color} { .swatch-#{$color} {
color: color-yiq($value);
background-color: #{$value}; background-color: #{$value};
@include color-yiq($value);
} }
} }
@each $color, $value in $grays { @each $color, $value in $grays {
.swatch-#{$color} { .swatch-#{$color} {
color: color-yiq($value);
background-color: #{$value}; background-color: #{$value};
@include color-yiq($value);
} }
} }

View File

@ -49,7 +49,7 @@
} }
// Color contrast // Color contrast
@mixin color-yiq($color) { @function color-yiq($color) {
$r: red($color); $r: red($color);
$g: green($color); $g: green($color);
$b: blue($color); $b: blue($color);
@ -57,9 +57,9 @@
$yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000; $yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
@if ($yiq >= 150) { @if ($yiq >= 150) {
color: #111; @return #111;
} @else { } @else {
color: #fff; @return #fff;
} }
} }

View File

@ -1,10 +1,10 @@
@mixin badge-variant($bg) { @mixin badge-variant($bg) {
@include color-yiq($bg); color: color-yiq($bg);
background-color: $bg; background-color: $bg;
&[href] { &[href] {
@include hover-focus { @include hover-focus {
@include color-yiq($bg); color: color-yiq($bg);
text-decoration: none; text-decoration: none;
background-color: darken($bg, 10%); background-color: darken($bg, 10%);
} }

View File

@ -4,13 +4,13 @@
// and disabled options for all buttons // and disabled options for all buttons
@mixin button-variant($background, $border, $active-background: darken($background, 7.5%), $active-border: darken($border, 10%)) { @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; background-color: $background;
border-color: $border; border-color: $border;
@include box-shadow($btn-box-shadow); @include box-shadow($btn-box-shadow);
@include hover { @include hover {
@include color-yiq($active-background); color: color-yiq($active-background);
background-color: $active-background; background-color: $active-background;
border-color: $active-border; border-color: $active-border;
} }