如何将引导程序原色更改为线性渐变?

cot*_*tut 4 css sass background-color twitter-bootstrap bootstrap-4

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

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

错误:

$link-hover-color:          darken($link-color, 15%) !default;
                           ^
      Argument `$color` of `darken($color, $amount)` must be a color
Run Code Online (Sandbox Code Playgroud)

Zim*_*Zim 7

问题是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);
}
Run Code Online (Sandbox Code Playgroud)

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