Dynamic Theme : Web Service : Ionic 2


Is there a way to update the Hex Color Code of “Primary” with the value that we get from Web Service?

If not, then how can we update entire theme of the application using the Hex Color Code that we recieve from Web Service?


I might be wrong here, but I don’t think it’s possible to change the value of a variable because that’s scss, which is not used in the runtime (See this SO post: Set scss variable’s value at runtime or startup). Instead, you could write a function that’s called upon receiving the new color and setting a Typescript variable that’s gonna change the color (or any other properties you might need change) and replace where needed.