Reputation: 998
How to change color of mat-spinner i tried this but doesn't work
Html
<mat-spinner [color]="red" ></mat-spinner>
<mat-spinner [color]="#ffffff" ></mat-spinner>
Upvotes: 4
Views: 12728
Reputation: 11
The only way that worked for me:
scss
.mat-mdc-progress-spinner{
--mdc-circular-progress-active-indicator-color: #yourColor;
}
There was no need to change anything in the html file.
Upvotes: 1
Reputation: 8937
The color property only accepts the values primary
, accent
and warning
. These are colors that correspond to the Material Design theme used in your project.
<mat-spinner color="primary"></mat-spinner>
If you want to override this with a custom color add the following css in a global style sheet:
.mat-progress-spinner circle, .mat-spinner circle {
stroke: /* color */
}
View encapsulation prevents the styles from working when placed in a component style sheet.
Upvotes: 4
Reputation: 998
This code worked for me :
scss
.mat-spinner-color::ng-deep circle{
stroke: #FFFFFF !important;
}
html
<mat-spinner [diameter]="25" class="mat-spinner-color"></mat-spinner>
Upvotes: 12
Reputation: 26710
The color
input accepts three values:
primary
: The primary palette of your appwarn
: The warn palette of your appaccent
: The accent palette of your appTo use hex codes, you can only do it with CSS. I suggest you use the Chrome DevTools to see which CSS classes to target. Note that you should use the !important
selector as well.
Upvotes: 1