Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the background-color and color of matBadge?

I want to change both the background and text color of a Material badge instead of using the standard material color, how do I do this?

<mat-icon matBadge="{{this.userService.numberOfCartItems}}" 
     matBadgePosition="above after" matBadgeColor="accent">
     shopping_cart
</mat-icon>
like image 664
koque Avatar asked Mar 03 '23 20:03

koque


1 Answers

You can change the background and color properties for the class mat-badge-content:

.mat-badge-content {
    background: red;
    color: blue;
}
like image 158
Thomas Hetzer Avatar answered Mar 08 '23 23:03

Thomas Hetzer