2
是否有任何優雅的方式使用角色2材質中的按鈕使用較亮/較暗的主色或深色變體,而無需用手重新創建整個樣式?Angular 2材質在按鈕上使用較淺/較深的顏色
是否有任何優雅的方式使用角色2材質中的按鈕使用較亮/較暗的主色或深色變體,而無需用手重新創建整個樣式?Angular 2材質在按鈕上使用較淺/較深的顏色
如果您使用的青菜可以導入材料主題化到您的SCSS文件和目標材料的顏色,像這樣:
app.component.scss
@import '[email protected]/material/theming';
.buttonPrimary {
background-color: mat-color($mat-purple, 200);
}
.buttonAccent {
background-color: mat-color($mat-amber, A200);
}
app.component.html
<button md-raised-button class="buttonPrimary">primary</button>
<button md-raised-button class="buttonAccent">accent</button>
多數民衆贊成我是這樣做,儘管爲了quickien我最終只是更輕,黑暗的班級適用於主要和重音,以及不同類型的按鈕。但是,這就是我所做的很重要的事情。 –
https://material.angularjs.org/latest/api/directive/mdColors –
此刻,t這裏沒有這個功能,雖然有一個提交的問題:https://github.com/angular/material2/issues/6059 – Edric