I have an app with multiple material themes in theme.scss file:
// Light theme
$light-primary: mat-palette($mat-grey, 200, 500, 300);
$light-accent: mat-palette($mat-brown, 100);
$light-warn: mat-palette($mat-deep-orange, 200);
$light-theme: mat-light-theme($light-primary, $light-accent, $light-warn);
.light-theme {
@include angular-material-theme($light-theme)
}
// Red theme
$red-primary: mat-palette($mat-red, 700, 500, 300);
$red-accent: mat-palette($mat-amber, 200);
$red-warn: mat-palette($mat-brown, 200);
$red-theme: mat-light-theme($red-primary, $red-accent, $red-warn);
.red-theme {
@include angular-material-theme($red-theme)
}
if I want to change the theme of the app I can do it by switching existing themes. Now I want to add a feature that let the user to create his custom theme with a color picker that sets $primary, $accent and $warn colors in the app, then post the new created style in the db.
I'm using ngx-color-picker to set colors, but I don't know how to set the custom theme and to use it on user access.
I'm using Angular 6 and material 2
Thanks for help