Aman Sadhwani
Aman Sadhwani

Reputation: 3658

How to Dynamically apply our own custom themes in zk 8.5

I have made my own custom theme.

As i set this theme in zk.xml

<library-property>
     <name>org.zkoss.theme.preferred</name> 
    <value>MYTheme</value>
 </library-property>

the theme is being applied ,but as i will be creating My own multiple custom themes how do i choose it programitacally?

Upvotes: 0

Views: 824

Answers (1)

cor3000
cor3000

Reputation: 956

The available methods and a way to customize the theme resolution are described in our documentation on Switching Themes.

You can change the default theme for all users at runtime by setting the library property (after reloading the page the theme is applied):

Library.setProperty("org.zkoss.theme.preferred", "custom");
Executions.sendRedirect("");

To switch the theme for an individual user the following method sets a cookie (by default):

Themes.setTheme(Executions.getCurrent(), "custom");
Executions.sendRedirect("");

Robert

Upvotes: 1

Related Questions