角度材料步进更改图标颜色

问题描述 投票:2回答:1

我使用角度6和角度材料。我正在使用角度材料的垫步进器。想要更改默认,活动和已访问步骤的mat-icon颜色。有人可以帮忙吗?

:host /deep/ mat-horizontal-stepper .mat-horizontal-stepper-header-container .mat-step-icon {
    background-color: "red" !important;
    color: #fff !important;
}

.mat-step-icon-selected,
.mat-step-icon-state-done,
.mat-step-icon-state-edit {
  background-color: "blue";
  color:#fff;
}  

也试过这个:

/deep/ mat-step-header.mat-horizontal-stepper-header > div.mat-step-icon-selected {
    background-color:'red';
}

但不行

谢谢

angular angular-material
1个回答
0
投票

我能够在项目根目录的styles.css文件中使用以下样式将颜色更改为红色,而不是组件的样式表

.mat-step-header .mat-step-icon-selected, .mat-step-header .mat-step-icon-state-done, 
.mat-step-header .mat-step-icon-state-edit {
    background-color: red !important;
    color: red !important;
}

要隐藏每个步骤中的数字,只需在ng-star-inserted类的样式中使用display none

.ng-star-inserted {display: none}
© www.soinside.com 2019 - 2024. All rights reserved.