how to change Sass Color Variables in runtime?

0
In Atlas there are a bunch of variables you can configure. But what if we have a single application that serves multiple companies that would all like to tweak their own colors in an admin panel? Is this possible? what solutions or workarounds are there? what are the drawbacks? How would you tackle this problem? //== Step 1: Brand Colors $brand-default: #DDDDDD !default; $brand-primary: #0595DB !default; $brand-inverse: #252C36 !default; $brand-info: #48B0F7 !default; $brand-success: #76CA02 !default; $brand-warning: #f99b1d !default; $brand-danger: #ed1c24 !default;  
asked
3 answers
1

Sadly I think this is not so easy to accomplish in runtime. You would have to call some javascript to replace all the color-definitions in the css. Or you could use CSS variables (as far as I know not supported in every browser) and set them on pageload. But I can't promise, that it will work. 

answered
1

we ended up using:

https://forum.mendix.com/link/questions/86103

StyleSheet switcher Widget

answered
1

Style switching is very interesting

Instead of using that widget, for performance reasons, you can serve up the CSS on either an request handler or PRS

Unfortunately SASS is a bit complicated to implement in a runtime workflow but is possible using something like libsass, but creating a managable runtime interface for this is overkill

It really helps to have all of this runtime configurable especially on fully branded multitenant projects where each mendix website is supposed to look unique but runs off the same server, and you want to add styles and not deploy for nonsense. You also need to program some interfaces to manage, edit, export, import, and remote transfer your styles.

Styles

Fragments

Editor

If anybody has come up with a workable server side sass implementation within the Mx runtime, I’d be very interested in finding out more

answered