Good morning, I have an Angular page that contains tabs made with Mat Tab. I managed to set the background colour of the active tab via scss with the following code and everything works correctly:
::ng-deep .mat-tab-label.mat-tab-label-active {
background-color: var(--user-main-color);
font-weight: 900;}
But now I would like to customise the colour dynamically, taking it via a REST call to the backend where the colour configuration is set. how can i do this? I thought of using [style.background-colour]="variable-name" but I don't understand how it can be done only for the active tab. thank you very much
try this:
UPDATE:
if you want change styles in typescript try this:
ts:
in HTML file:
in angular material 15 and later this code should work. in previous versions i think you have to replace (mdc-tab--active) class with your classes.