I have a project finished and i have to add a new function to put 1 theme depending the user connected. I have solvented this point added a dynamic class in
You could also load the themes in JSON and loop through the options.
for (const col in this.theme.colors) {
if (col) {
for (const key in this.theme.colors[col]) {
if (key) {
this.themeWrapper.style.setProperty(key, this.theme.colors[col][key]);
}
}
}
}
And I change the “appTheme” to “theme-1” or “theme-2” etc, depending of user… and this works, the big part the design it’s changed, but there is a little part that use this map: