如何为垫子按钮添加自定义颜色?

问题描述 投票:0回答:1
html css angular
1个回答
0
投票

我认为你应该能够通过篡改你的 src/styles.scss 文件来篡改哪种颜色是你的主要辅助颜色等,例如你可以这样做:

@import '~@angular/material/theming';

$custom-primary: mat-palette($mat-indigo);
$custom-accent: mat-palette($mat-pink);
$custom-warn: mat-palette($mat-red);

$custom-theme: mat-light-theme(
  $custom-primary,
  $custom-accent,
  $custom-warn
);

@include angular-material-theme($custom-theme);

那么你应该可以使用这样的颜色:

    <button (click)="gotoDashboardHome()" mat-raised-button color="custom" class="centered-button">
  <mat-icon>reply</mat-icon>
  <span class="button-text">Back</span>
</button>
© www.soinside.com 2019 - 2024. All rights reserved.