Angular 2 Material use lighter/darker colors on button

后端 未结 1 1604
伪装坚强ぢ
伪装坚强ぢ 2021-02-20 09:17

Is there any elegant way to use lighter/darker variants of either primary or accent colors with buttons in angular 2 material without recreating whole styling by hand?

1条回答
  •  梦毁少年i
    2021-02-20 09:55

    If you use sass you can import material theming into your scss file and target material colors like so:

    app.component.scss

    @import '~@angular/material/theming';
    
    .buttonPrimary {
        background-color: mat-color($mat-purple, 200);
    }
    
    .buttonAccent {
        background-color: mat-color($mat-amber, A200);
    }
    

    app.component.html

    
    
    

    0 讨论(0)
提交回复
热议问题