Angular Material - 改变点击的 mat-list-option 的颜色 [英] Angular Material - change color of clicked mat-list-option

查看:22
本文介绍了Angular Material - 改变点击的 mat-list-option 的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能更改选中复选框的默认颜色(mat-pseudo-checkbox-checked):

Is there a possibility to change the default color of a checked checkbox (mat-pseudo-checkbox-checked):

<mat-selection-list #shoes>
  <mat-list-option *ngFor="let shoe of typesOfShoes">
    {{shoe}}
  </mat-list-option>
</mat-selection-list>

我试过了:

.mat-pseudo-checkbox-checked {
    background-color: #00f;
}

但没有影响.

推荐答案

我不确定,但你可以尝试使用这个

I am not sure but you can try using this

.mat-select-content, .mat-select-panel-done-animating {
     background: mat-color($background, card); 
}

.mat-select-content, .mat-select-panel-done-animating {
    background: mat-color($background, card);
    .mat-option {
        color : mat-color($foreground, text);
    }
}

详情,您也可以查看以下链接https://github.com/angular/material2/blob/master/src/lib/list/_list-theme.scss

for details, you can also check the following link https://github.com/angular/material2/blob/master/src/lib/list/_list-theme.scss

这篇关于Angular Material - 改变点击的 mat-list-option 的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆