Based on @nipun-kavishka answer
To override color of a specific badge element and state (warn
, accent
etc) without disrupting style encapsulation, we can add a marker class (my-custom-badge-accent
) for badge container and override its descendent mat-badge-content
style. So all badge containers having my-custom-badge-accent
class having accent
color will be styled as specified.
In global styles.css:
.my-custom-badge-accent.mat-badge-accent .mat-badge-content {
background-color: #f1bf28;
color: white;
}
In HTML template:
<span class="my-custom-badge-accent" [matBadge]="haveWarningsFlag" matBadgeColor="accent"> </span>