问题
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