19
Views
7
Comments
Solved
I need to change the CSS of the mobile app depending on the Tentant

I have a mobile app with many screens, now the customer wants this app to be multitenant, the background color and font needs to change per tenant. I have worked through many examples from the community. I cannot make it work for I don't want to have a hugh amount of CSS changes like Style or Class property changes like: "background-color: " + If(LocalQuickplug,"#e5b041","#fc4f00") etc.

Does anyone have a robust idea to make it work?

Rank: #891
Solution

I have made this piece of Javascript in the OnRender of my mobile app

It's changing the root elements of the app! I also needed another font and that's working too. 

This idea came to me by the wonderfull URL https://css-tricks.com/making-custom-properties-css-variables-dynamic/

Rank: #171

Ineke de Raaf wrote:

I have made this piece of Javascript in the OnRender of my mobile app

It's changing the root elements of the app! I also needed another font and that's working too. 

This idea came to me by the wonderfull URL https://css-tricks.com/making-custom-properties-css-variables-dynamic/

 

 Hi Ineke de Raaf ,

Thank you for idea.

:D

Cheers.

Rank: #259

you can have different theme and can also keep their names in db and in layout refer it from db .


Rank: #891

thanks for your reply Mahesh! do you know how to activate the theme on runtime in mobile?

Ineke de Raaf wrote:

thanks for your reply Mahesh! do you know how to activate the theme on runtime in mobile?

 Check this ,May helps


Regards,

Rama

 

Rank: #891

I can add it as a Style : 

I can add it as a Class : 

But this is a lot of work since I have a big CSS for the app to be changed. I was looking for something more general, such as a complete CSS difference for the one or the other. I understood there could be some Javascript to change the CSS at runtime? 

Rank: #891
Solution

I have made this piece of Javascript in the OnRender of my mobile app

It's changing the root elements of the app! I also needed another font and that's working too. 

This idea came to me by the wonderfull URL https://css-tricks.com/making-custom-properties-css-variables-dynamic/

Rank: #171

Ineke de Raaf wrote:

I have made this piece of Javascript in the OnRender of my mobile app

It's changing the root elements of the app! I also needed another font and that's working too. 

This idea came to me by the wonderfull URL https://css-tricks.com/making-custom-properties-css-variables-dynamic/

 

 Hi Ineke de Raaf ,

Thank you for idea.

:D

Cheers.