Reputation: 21
I change dynamically my theme in My project, And I want to change the color(or background) of the Angular Material component : checkbox, radio button, slide toggle, textarea...
How to change them
example :
<mat-slide-toggle [(ngModel)]="expression" [color]="colorCss"></mat-slide-toggle>
ColorCss is the variable from the component
Thanks in advance.
Upvotes: 2
Views: 2527
Reputation: 554
While using material components, Color attribute is only accepts three colors i.e. primary, warn and accent which are default in your theme.
If you are changing theme it means your primary, warn and accent colors are get changed.
If your material component is having one from these color then it get automatically changed. But if your material component having custom colors than you have to change that with the help of ngStyle or ngClass directives.
Upvotes: 0