我正在尝试将 bootstrap 原色更改为 linear-gredient,但出现错误:

$theme-colors: (
  "primary": linear-gradient(to right, #373b44, #4286f4)
);

错误:

最佳答案

问题是 linear-gradient 用于 background-image ,而不是前景 color 。当 SASS 编译器尝试构建 Bootstrap 时,它不能在背景图像上使用 darken(..) 函数。

相反,您可以更改具有这样背景的元素的 primary 颜色...

.bg-primary,
.btn-primary,
.badge-primary,
.alert-primary {
    background-image: linear-gradient(to right, #373b44, #4286f4);
}

https://www.codeply.com/go/XXUxFr6tEZ

关于css - 如何将 bootstrap 原色更改为线性渐变?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50490814/

10-13 06:04