引导程序在其文档中写道:To modify an existing color in our $theme-colors map, add the following to your custom Sass file:
$theme-colors: (
"primary": #0074d9,
"danger": #ff4136
);
但是这在内部如何工作?我一直认为sass中的地图是不可变的,这意味着地图的内容无法更改。我认为我必须执行以下操作才能覆盖地图中的某些值:
$theme-colors: map-merge($theme-colors, (
"primary": #0074d9,
"danger": #ff4136
));
但是bootstrap的解决方案似乎也起作用。为什么?我想念什么?我不明白什么?
答案 0 :(得分:0)
在bootstrap git repo中查找答案就像您假设的那样。 link to repo
$theme-colors: () !default;
// stylelint-disable-next-line scss/dollar-variable-default
$theme-colors: map-merge(
(
"primary": $primary,
"secondary": $secondary,
"success": $success,
"info": $info,
"warning": $warning,
"danger": $danger,
"light": $light,
"dark": $dark
),
$theme-colors
);