1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-31 00:59:51 +02:00

Add checks to fix color contrast issues (#32085)

This commit is contained in:
Martijn Cuppens
2020-11-08 19:49:26 +01:00
committed by GitHub
parent 4ed742e4db
commit 67847b0aab
3 changed files with 19 additions and 7 deletions

View File

@@ -43,9 +43,15 @@
// scss-docs-start alert-modifiers
// Generate contextual modifier classes for colorizing the alert.
@each $color, $value in $theme-colors {
.alert-#{$color} {
@include alert-variant(scale-color($value, $alert-bg-scale), scale-color($value, $alert-border-scale), scale-color($value, $alert-color-scale));
@each $state, $value in $theme-colors {
$background: scale-color($value, $alert-bg-scale);
$border: scale-color($value, $alert-border-scale);
$color: scale-color($value, $alert-color-scale);
@if (contrast-ratio($background, $color) < $min-contrast-ratio) {
$color: mix($value, color-contrast($background), abs($alert-color-scale));
}
.alert-#{$state} {
@include alert-variant($background, $border, $color);
}
}
// scss-docs-end alert-modifiers