@mixin button-variant($background, $border, $hover-background: darken($background, 7.5%), $hover-border: darken($border, 10%), $active-background: darken($background, 10%), $active-border: darken($border, 12.5%)) { color: color-yiq($background); background-color: $background; border-color: $border; &:hover { color: color-yiq($hover-background); background-color: $hover-background; border-color: $hover-border; } &:focus, &.focus { box-shadow: 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5); } // Disabled comes first so active can properly restyle &.disabled, &:disabled { color: color-yiq($background); background-color: $background; border-color: $border; } &:not(:disabled):not(.disabled):active, &:not(:disabled):not(.disabled).active, .show > &.dropdown-toggle { color: color-yiq($active-background); background-color: $active-background; border-color: $active-border; &:focus { box-shadow: 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5); } } } @mixin button-outline-variant($color, $color-hover: color-yiq($color), $active-background: $color, $active-border: $color) { color: $color; border-color: $color; &:hover { color: $color-hover; background-color: $active-background; border-color: $active-border; } &:focus, &.focus { box-shadow: 0 0 0 $btn-focus-width rgba($color, .5); } &.disabled, &:disabled { color: $color; background-color: transparent; } &:not(:disabled):not(.disabled):active, &:not(:disabled):not(.disabled).active, .show > &.dropdown-toggle { color: color-yiq($active-background); background-color: $active-background; border-color: $active-border; &:focus { box-shadow: 0 0 0 $btn-focus-width rgba($color, .5); } } } @each $color, $value in $theme-colors { .btn-#{$color} { @include button-variant($value, $value); } } @each $color, $value in $theme-colors { .btn-outline-#{$color} { @include button-outline-variant($value); } } .btn-link { color: $link-color; &:hover { color: $link-hover-color; } }