I am rewriting an AngularJS application where the theme of the application is provided by the server. Also the theme can be edited by the user within the application (via color pickers).
This was possible via the ng.material.IThemingProvider and the $mdTheming from Angularjs material. But In Angular those services do not exist. So that leaves me with the question, how can I dynamically create an Angular Material theme and use it?
The server response
I am getting the following data from the server:
"css": {
"--nav-font-color-accent": "#fff",
"--nav-font-color-active": "#fff",
"--primary": "#4f2d7f",
"--nav-background": "#fefffe",
"--nav-font-color": "#47a742",
"--warn": "#ff5722",
"--accent": "#00a8b5",
"--brand-color": "#47a742"
}
This data is then converted to an Angularjs-material theme via the ng.material.IThemingProvider:
this.themeProvider.definePalette('primaryPalette', this.generatePalette(config['--primary']));
this.themeProvider.theme('default')
.primaryPalette('primaryPalette')
Is there a way I can reproduce this functionality in Angular Material 7.1.0?