1

I want to add a couple of themes on my Angular app and I would like to let users to do it by theirselft.

I just want to make some changes to colours, so this should affect just few rows of my SCSS files:

styles.scss

html, body {
    background-color: black;
}

app/app.component.scss

.title {
    color: green;
}

.subtitle {
    color: grey;
}

.text {
    color: white;
}

How to make it changeable by the user at runtime?

I searched and searched on Google and even here on SO (for example this question), but all the answers deal with loading different style files at compile time, but this could not let users to change the theme when the app is running.

4
  • I think this one explains what you're looking for: stackoverflow.com/questions/47441036/…. So just using classes that will make your theme "switch". Commented Nov 7, 2018 at 15:53
  • This article may help you : dev.to/adamaso/angular-6-dynamic-themes-without-a-library-2e9c Commented Nov 7, 2018 at 16:04
  • @JeroenE I'm not using Material so your solution is not applicable in my case. Commented Nov 7, 2018 at 16:48
  • @Zooly It's me that I create themes, users should only select the one they like. So I will create for example 2 themes and user will be able to switch from one to another. Commented Nov 7, 2018 at 16:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.