我在我的 scss 文件中覆盖 bootstrap theme-colors,如下所示
// set variables
$primary: #8dc3a7;
$light: #b4d6c1;
$starorange: #df711b;
// import functions and variables
@import "../node_modules/bootstrap/scss/functions";
@import "../node_modules/bootstrap/scss/variables";
$custom-theme-colors: (
"starorange": $starorange,
);
// modify theme colors
$theme-colors: map-merge($theme-colors, $custom-theme-colors);
// bootstrap import
@import "../node_modules/bootstrap/scss/bootstrap";
Run Code Online (Sandbox Code Playgroud)
我可以在按钮中使用starorange颜色,如下所示,并且它正确应用了颜色
<button class="btn btn-md btn-starorange">Send</button>
Run Code Online (Sandbox Code Playgroud)
但是,我无法在同一个 HTML 文档中为文本或背景使用相同的颜色,如下所示。
<div class="pb-1 text-starorange">
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
<i class="bi bi-star-fill"></i>
</div>
Run Code Online (Sandbox Code Playgroud)
或者
<section class="bg-starorange">
.... some html here ... …Run Code Online (Sandbox Code Playgroud)