I'm having trouble customizing the colors of the icons
In my mat-horizontal-stepper, I have five mat-steps (Part A, Part B ... Part E), each needing a different color based on certain business rules.
While I can change the color for all steps or the "selected" step, I can't seem to figure out how to dynamically change the icon background color for each individual part. I am using Angular v7.
The following CSS snippet sets the third mat-step icon's background color to green. It works, but I need to know how to change this color dynamically at run-time from the component (typescript).
::ng-deep .mat-step-header:nth-of-type(3) .mat-step-icon {
background-color: green!important;
}
I also attempted to use [ngClass]
, but it is ignored when added as a mat-step attribute. It only applies if I include it within the step label, which doesn't meet the requirement of changing the icon's background color instead of the labels.
Expected outcome: Being able to assign different colors to each step based on completion level, such as yellow, red, green, and black.
Current issue: Unable to dynamically adjust icon colors based on component variable settings