Angular Material - change color of md-radio-button [closed]

匆匆过客 提交于 2019-12-11 06:04:02

问题


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?


回答1:


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);
}

This one for the border :

.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);
}

Here is a working example.



来源:https://stackoverflow.com/questions/45368434/angular-material-change-color-of-md-radio-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!