obela06
obela06

Reputation: 335

problem to applied color by class in angular material component

I had angular material 10.2.5 in my angular 10 project. I includes the theme by adding this line

@import '@angular/material/prebuilt-themes/deeppurple-amber.css';

in my style.css I create a component and i use a material button with primary color ,but my button color is not applied.

 <button mat-button color="primary">Toogle</button>

enter image description here the button color must be blue

Any idea ?

Upvotes: 0

Views: 347

Answers (2)

Noman Fareed
Noman Fareed

Reputation: 284

To be able to import the angular-material theme in your styles.css file. First you have to add the angular-material to your angular project by running this command in CLI.

ng add @angular/material

Now you can import the angular-material file in styles.css by

@import '@angular/material/prebuilt-themes/deeppurple-amber.css';

For the reference you can visit https://material.angular.io/guide/getting-started

Upvotes: 0

Dayvid Kelly
Dayvid Kelly

Reputation: 124

You can't overwrite the angular material theme, unless you go through the material CSS to create a new color palette.

Upvotes: 0

Related Questions