I'm trying to theming my own components by handling two themes.
So I wrote the following code. Here is theme.scss
@import '~@angular/material/theming';
@include mat-core();
$theme-primary: mat-palette($mat-blue);
$theme-accent: mat-palette($mat-grey, A200, A100, A400);
$theme-warn: mat-palette($mat-red);
$theme: mat-light-theme($theme-primary, $theme-accent, $theme-warn);
$theme-dark: mat-dark-theme($theme-primary, $theme-accent, $theme-warn);
.theme {
@include angular-material-theme($theme);
}
.theme-dark {
@include angular-material-theme($theme-dark);
}
I wrote a simple component. Here is hello.component.scss
@import './../theme.scss';
@mixin change-color($theme) {
$config: mat-get-color-config($theme);
$primary: map-get($config, primary);
$accent: map-get($config, accent);
:host {
background-color: mat-color($accent, 100);
}
}
:host {
color: red
}
The problem here is that the color is fixed no matter if I change the theme.
I would like to use a color of a certain hue that change to another color when I switch to dark theme mode.
Is it possible ? How ?
Thanks for helping