角材料-更改md单选按钮的颜色 [英] Angular Material - change color of md-radio-button

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

问题描述

如何在Angular Material2中更改单选按钮的默认颜色?我阅读了有关此主题的几个问题,但没有一个可以解决这个问题.如何为类md-radio-button的元素设置绿色,黄色和红色?

How can the default color of radio buttons be changed in Angular Material2? I read a few questions on this topic but none of them solve this problem. How can I set green, yellow and red color for an element with class md-radio-button?

推荐答案

您可以将此规则用于单选按钮中心的颜色:

You can use this rule for the color of the center of your radio button :

.mat-radio-button.mat-accent .mat-radio-inner-circle {
  background-color: rgb(66, 134, 244);
}

此为边框:

.mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle {
  border-color: rgb(66, 134, 244);
}

这是一个圆圈,当您单击单选按钮时出现:

And this one for the circle which appears when you click on the radio button :

.mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
  background-color:rgba(66, 134, 244,.26);
}

此处是一个有效的示例.

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

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