角度材料更改复选框颜色 [英] angular-material change checkbox color

查看:36
本文介绍了角度材料更改复选框颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 angular-material2 的复选框.目前复选框的默认颜色为紫色.
看起来他们已将复选框的默认颜色从主要"更改为重音.
有没有办法在不覆盖 css 的情况下获得主要"(绿色)颜色而不是紫色.
我试过给 color="primary" ,但这没有用.

I'm using checkbox of angular-material2. Currently the default color of checkbox is coming as purple color.
Looks like they have changed default color of checkbox from "primary" to accent.
Is there a way to get "primary"(green) color instead of purple without overriding css.
I tried giving color="primary" to but that didn't worked.

代码:

Code : <md-checkbox></md-checkbox>

导入语句:

import {MdCheckbox} from '@angular2-material/checkbox';

Plunker http://plnkr.co/edit/sFC0kfdzj7fxtUC3GXdr?p=preview

推荐答案

对于 Angular Material 7,适用于轮廓颜色和内部填充颜色

For Angular Material 7, works for outline color and inside filled in color

::ng-deep .mat-checkbox-checked.mat-accent .mat-checkbox-ripple .mat-ripple-element {
    opacity: 0.03 !important;
    background-color: #005691!important;
  }

::ng-deep .mat-checkbox-checked.mat-accent .mat-checkbox-background,.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
    background-color: #005691;
  }

这篇关于角度材料更改复选框颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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