The ZK Theme Template serves as a base theme, allowing developers to make changes and create custom ZK themes. It comes with continuous/incremental compile and live-reload features to minimize the turn-around time when developing a theme.
Require Node.js >= 10.16
clone the zkThemeTemplate project
./init.sh
npm install
mvn clean package
The jar file will be target/___THEME_NAME___.jar
- Open
src/archive/web/zul/less/_zkvariables.less
- Modify
@themeProfile
to "compact".
@themeProfile: "default";
@themePalette: "iceblue";
- now the theme uses the compact profile.
mvn test exec:java@preview-app
open a simple preview page in the browser, add your own pages containing the components to preview http://localhost:8080
in a separate console:
npm run zklessc-dev
update less-files with text editor, save file -> auto zkless compile -> browser will reload style sheet zk.wcs
-
Put
___THEME_NAME___.jar
inWEB-INF/lib
, then___THEME_NAME___.jar
will become your default theme if there is no other theme. -
Now you can also dynamically switch between different themes by cookie or library property
-
Use library-property
<!-- in WEB-INF/zk.xml --> <library-property> <name>org.zkoss.theme.preferred</name> <value>___THEME_NAME___</value> </library-property>
-
Use cookie to switch theme, add a cookie
zktheme=___THEME_NAME___
It does not require a server restart, but user has to refresh the browser.