正在发生的事情是:
Bootstrap的
_variables.scss
这是:
// Form validation
...
$form-feedback-invalid-color: theme-color("danger") !default;
$form-feedback-icon-invalid: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='#{$form-feedback-icon-invalid-color}' viewBox='0 0 12 12'><circle cx='6' cy='6' r='4.5'/><path stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/><circle cx='6' cy='8.2' r='.6' fill='#{$form-feedback-icon-invalid-color}' stroke='none'/></svg>") !default;
...
$form-validation-states: () !default;
$form-validation-states: map-merge(
(
...
"invalid": (
"color": $form-feedback-invalid-color,
"icon": $form-feedback-icon-invalid
),
),
$form-validation-states
);
因此,要覆盖
$form-feedback-invalid-color
,我还需要覆盖
$form-validation-states
因为这就是Bootstrap读取它的地方。
Reference
.