Angular Material - 改变 md-radio-button 的颜色 [英] Angular Material - change color of md-radio-button

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

问题描述

如何在 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);
}

这里是一个工作示例.

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

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