Runtime CSS

Forum to discuss the new web client version of Servoy.

Runtime CSS

Postby marco.rossi » Thu Jan 03, 2019 5:55 pm

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:

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
Marco Rossi
Senior Analyst Developer
Freelance Consultant

IT Manager @Mantho
Webmaster @Sitoliquido
Posts: 64
Joined: Sun Apr 12, 2015 9:33 pm

Re: Runtime CSS

Postby Joas » Fri Jan 04, 2019 12:24 pm

Take a look at:
Code: Select all

I haven't tried it myself, but it looks like it could be what you are looking for.
Joas de Haan
Yield Software Development
User avatar
Site Admin
Posts: 784
Joined: Mon Mar 20, 2006 4:07 pm
Location: Amersfoort, NL

Re: Runtime CSS

Postby mboegem » Fri Jan 04, 2019 6:25 pm

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:

Code: Select all
var _oTag = {
           tagName: "link",
           attrs : [{
            name: "rel",
            value: "stylesheet"
            name: "href",
            value: "data:text/css;base64," + _sBase64EncodedContent

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.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

User avatar
Posts: 1461
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 0 guests