how to change Sass Color Variables in runtime? - Mendix Forum

how to change Sass Color Variables in runtime?


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;


2 answers

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. 


we ended up using:

StyleSheet switcher Widget