The Theme Provider

If you prefer to decide the theme at the run time depending on the current user, cookie, locale or others, you can implement a theme provider. A theme provider is a class that implements the org.zkoss.zk.ui.util.ThemeProvider interface.

package my;
public class MyThemeProvider implements ThemeProvder {
        public Collection getThemeURIs(Execution exec, List uris) {        
            for (Iterator it = uris.iterator(); it.hasNext();) {            
                if ("~./zul/css/norm*.css.dsp*".equals(it.next()))                
                    it.remove(); //remove the default theme                    
            }            
            HttpServletRequest req = (HttpServletRequest)exec.getNativeRequest();            
            uris.add(getMyThemeURI(req));            
            return uris;            
        }}        

Then, you configure WEB-INF/zk.xml by adding the following lines.

<desktop-config>
    <theme-provider-class>my.MyThemeProvider</theme-provider-class>    
</desktop-config>