Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 6 Material - Hues and How to change the color of mat radio button

How can I change the color of the using CSS?

Saw on another post that if I use the following code, it would change it, but I had no luck with it so far.

.mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
    background-color:rgb(255, 37, 37);
  }

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

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

Also, how could I use the rest of the color hues?

<mat-radio-button color="accent">Hello, World</mat-radio-button>

Let's say that I want to use from the Accent color, the hue of 300 or A100, how would I go about to doing that?

I've tried using accent-100 and accent hue-100 but, it doesn't work

like image 906
Konstantinos Kosyfarinis Avatar asked Sep 28 '18 09:09

Konstantinos Kosyfarinis


2 Answers

add this css in your style.css/style.scss

Stackblitz

style.css/style.scss

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

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

.mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
    background-color:rgb(255, 37, 37,.26);
}
like image 124
Krishna Rathore Avatar answered Oct 25 '22 17:10

Krishna Rathore


None of the above worked for me. But this one worked i.e put color="primary" on mat -radio button. ie

<mat-radio-button color="primary" value=1>Active</<mat-radio-button>. 

See example below

https://stackblitz.com/edit/angular-material2-issue-ethbcx

like image 16
yogeshmanjhi Avatar answered Oct 25 '22 18:10

yogeshmanjhi