Runtime CSS

Hi,
I would like to let the user be able to change the style of the solution.

An example could be to change the font color of the entire solution.

To do this I’m successfully used the instruction:
application.overrideStyle(“CSS/black_font.css”,“CSS/blue_font.css”)

The problem of following this way, is that I need to have infinite combinations of pre-compiled stylesheets.

Does exist a way to create a runtime stylesheet and to use the “application.overrideStyle” method to use it?

Best regards

Take a look at:

solutionModel.newStyle(name,content)

I haven’t tried it myself, but it looks like it could be what you are looking for.

Hi Marco,

this can be achieved to add a reference to the generated css file.
In my case I didn’t want to expose the css files using a public location, so I read the css file from disk, Base64 encode the content and add that to your page like this:

var _oTag = {
			  tagName: "link",
			  attrs : [{
			   name: "rel",
			   value: "stylesheet"
			  },{
			   name: "href",
			   value: "data:text/css;base64," + _sBase64EncodedContent
			  }]
			 }
		
			 plugins.ngclientutils.contributedTags.push(_oTag);

If you store the generated on a public location you can change the href value to valid url just as you would do building a normal webpage.

Hope this helps.

Thank you Marc and Joas,
sorry if my answer comes in late but I got trouble with my forum user login.

Best regards