Change style dynamically

Hi,

How can I change imported css style theme dynamically for my angular web app
my style.scss infludes the following lines :
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';
@import '../node_modules/@syncfusion/ej2-calendars/styles/material.css';
@import '../node_modules/@syncfusion/ej2-dropdowns/styles/material.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';
@import '../node_modules/@syncfusion/ej2-lists/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import '../node_modules/@syncfusion/ej2-navigations/styles/material.css';
@import '../node_modules/@syncfusion/ej2-angular-schedule/styles/material.css';
.dark-theme {
@import '../node_modules/@syncfusion/ej2-base/styles/material-dark.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/material-dark.css';
@import '../node_modules/@syncfusion/ej2-calendars/styles/material-dark.css';
@import '../node_modules/@syncfusion/ej2-dropdowns/styles/material-dark.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/material-dark.css';
@import '../node_modules/@syncfusion/ej2-lists/styles/material-dark.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material-dark.css';
@import '../node_modules/@syncfusion/ej2-navigations/styles/material-dark.css';
@import '../node_modules/@syncfusion/ej2-angular-schedule/styles/material-dark.css';
}
And I would like to apply the dark theme class when I toggle a switch button
Regards

1 Reply 1 reply marked as answer

JA Jesus Arockia Sankaran S Syncfusion Team May 13, 2021 06:48 AM UTC

Hi furious, 

Thank you for contacting Syncfusion support. 

We have checked your query and we have already published a KB (Knowledge Base) for this that you can find from the following link. 


Also, we want to inform you that we could not simply change the theme by dynamic import which is not feasible. Because the import path only present inside the classes instead the content and we request you follow the method in the above KB for your reference.  

Please get back to us if you have any queries. 

Regards, 
Jesus Arockia Sankaran S 


Marked as answer
Loader.
Up arrow icon