2017-10-05 17 views
1

我在_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輔助色?

+0

以供將來參考,這是拉動請求中進行了更改:https://開頭github上。 com/twbs/bootstrap/pull/22836 – sigbjornlo

回答

1

不知道這是最好的方式,但我得到了我需要使用值:

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

'theme-color(「secondary」)'在可讀性方面可能更清晰一點,不過它完全符合你的要求,一張地圖 - 獲取$ theme-colors。 – sigbjornlo