How to Build and Change ZKoss Theme
ZKThemer
zkthemer is an automatic color theme generator
Download
You can download zkthemer from zkthemer.jar.
How to use it
zkthemer is a java command line application, it should work on any Java 6 platform, tested on Linux and Windows.
Generate New Colour Theme
The instructions shown are on a Windows cmd line. It should be similar on a bash shell. In the following, we assume that the zkthemer.jar has been placed in C:\rator\cdrator-ZKThemer.
C:\rator\cdrator-ZKThemer>java -jar zkthemer.jar Option is mandatory: --baseColor -c value : Base color in 6 hex digit format, for example: A4BC03 Option is mandatory: --ignoreFiles -i value : The names of ignore components (splitter with comma such as '-i colorbox,grid', type '-i n' if won't) Option is mandatory: --themeName -t value : Theme name Option is mandatory: --zklib -z value : Location (directory) containing the zk jars The options available are: --baseColor -c value : Base color in 6 hex digit format, for example: A4BC03 --ignoreFiles -i value : The names of ignore components (splitter with comma such as '-i colorbox,grid', type '-i n' if won't) --themeName -t value : Theme name --zklib -z value : Location (directory) containing the zk jars
The first step is to put all the zk jars of your current version in one directory, for example a sub-directory called zk-jars as in the following:
C:\rator\cdrator-ZKThemer>cd zk-jars C:\rator\cdrator-ZKThemer\zk-jars>dir Volume in drive C is system Volume Serial Number is C4BE-F9D9 Directory of C:\rator\cdrator-ZKThemer\zk-jars 05/08/2012 10:38 AM <DIR> . 05/08/2012 10:38 AM <DIR> .. 03/08/2012 06:07 PM 441,834 zcommon-5.0.9.jar 03/08/2012 06:07 PM 1,127,215 zk-5.0.9.jar 03/08/2012 06:08 PM 133,420 zkplus-5.0.9.jar 03/08/2012 06:07 PM 1,434,274 zul-5.0.9.jar 03/08/2012 06:07 PM 205,494 zweb-5.0.9.jar 5 File(s) 3,342,237 bytes 2 Dir(s) 35,672,846,336 bytes free
We then run zkthemer with the theme name "cdrator-color" , giving 949599(gray) as the basic color
C:\rator\cdrator-ZKThemer>java -jar zkthemer.jar -c 949599 -z zk-jars -t cdrator-color -i n Generated file: cdrator-color.jar
After running the command a new jar called "cdrator-color.jar" is generated.
Use New Theme
It is not enough to just drop the created jar in your application classpath. You have to do the following:
1. In your zk.xml add the following
<desktop-config> <theme-provider-class>zkthemer.ThemeProvider</theme-provider-class> </desktop-config>
2. Place the cdrator-color.jar in your application classpath.
3. Restart the server. Your application will now have the gray color as base for all the components, like in the image bellow:
Fig 1. A ZKoss window with gray base color