【问题标题】:Equivalent of $btn-secondary-color on Bootstrap 4 Beta相当于 Bootstrap 4 Beta 上的 $btn-secondary-color
【发布时间】:2017-10-06 02:57:24
【问题描述】:

我在_custom.scss 文件中使用了变量$btn-secondary-color,但该变量在Bootstrap 4 Beta 上不存在。好像已经换成这个了:

// _variables.scss

$theme-colors: (
  primary: $blue,
  secondary: $gray-600,
  success: $green,
  info: $cyan,
  warning: $yellow,
  danger: $red,
  light: $gray-100,
  dark: $gray-800
) !default;

// _buttons.scss
@each $color, $value in $theme-colors {
  .btn-#{$color} {
    @include button-variant($value, $value);
  }
}

那么如何修复我的代码并引用_custom.scss 中按钮的辅助颜色?

【问题讨论】:

标签: twitter-bootstrap sass twitter-bootstrap-4


【解决方案1】:

不确定这是否是最好的方法,但我得到了我需要的价值:

color: map-get($theme-colors, secondary);

【讨论】:

  • theme-color("secondary") 在可读性方面可能更清晰一些,尽管 ofc 完全符合您的要求,$theme-colors 上的地图获取。
猜你喜欢
  • 1970-01-01
  • 2014-01-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多