角度材料更改复选框颜色 [英] angular-material change checkbox color
问题描述
我正在使用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.
代码:<md-checkbox></md-checkbox>
导入声明:
import {MdCheckbox} from '@angular2-material/checkbox';
柱塞 http://plnkr.co/edit/sFC0kfdzj7fxtUC3GXdr?p=预览
推荐答案
如果您使用主题,则不必添加CSS,只需将属性颜色添加到<mat-chechkbox>
You don't have to add css if you'r using theme, just add attribute color to <mat-chechkbox>
<mat-checkbox color="primary">Primary</mat-checkbox>
可以使用color属性更改
<mat-checkbox>
的颜色.默认情况下,复选框使用主题的强调色.可以将其更改为主要"或警告" 复选框|角材料
The color of a
<mat-checkbox>
can be changed by using the color property. By default, checkboxes use the theme's accent color. This can be changed to 'primary' or 'warn' Checkbox | Angular Material
这篇关于角度材料更改复选框颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!