我在我的 Angular 应用程序中使用 mat-select。我想更改文本颜色,但颜色没有改变。
<mat-select style="color: red" [(ngModel)]="someValue">
<mat-option>class="empty-select"</mat-option>
<mat-option class="not-empty-select" *ngFor="let unit of units [value]="unit">{{unit}}</mat-option>
</mat-select>
我可以毫无问题地更改背景颜色,但文本颜色不会改变。
原文由 Nancy 发布,翻译遵循 CC BY-SA 4.0 许可协议
这帮助我更改了所选文本的样式:
::ng-deep .mat-selected .mat-option-text { color: white!important; }