Customizing Standard Themes
Here we discuss how to customize the standard themes, such as iceblue, breeze and silver gray.
Customize standard themes using template - ZK 8.0.2 and later
Since ZK 8.0.2, all style-related files are collected in one template theme project, making it much easier to create a custom theme. The main idea here is to have a ZK template theme as the base theme, which then allows ZK developers to extend the base theme and make as many modifications as desired. And since we now have this idea of theme extension, ZK developers can now create a base theme for their project, which is based on ZK template theme, and then extend their own base theme to build more custom themes.
For detailed steps please read New Approach for Building Custom Theme
Change Font Size and Family - ZK 7.0.0
In ZK 7, you can use CSS to define the fonts (there are no special config attributes available/required anymore)
If you want to define the default font family for ZK components only:
[class*="z-"]:not([class*="z-icon-"]) {
font-family: Arial;
}
If you want to define the default font family for the whole page body (including html native element):
body *:not([class*="z-icon-"]) {
font-family: Arial;
}
Change Font Size and Family - ZK 6.5 and below
The default theme of ZK components uses the library properties to control the font size and family. You can change them easily by specifying different values.
Notice that the library properties control the theme for the whole application. If you want to provide per-user theme (like zkdemo does), you have to implement a theme provider.
Font Size
Deprecated since 7.0.0
The default theme uses the following library properties to control the font sizes.
The default font size. It is used in the most components. | ||
The smaller font size used in the component that requires small fonts, such as toolbar. | ||
The extremely small font size; rarely used. | ||
The font size used in the menu items. |
To change the default value, you can specify the library properties in WEB-INF/zk.xml as follows.
<library-property>
<name>org.zkoss.zul.theme.fontSizeM</name>
<value>12px</value>
</library-property>
<library-property>
<name>org.zkoss.zul.theme.fontSizeS</name>
<value>10px</value>
</library-property>
<library-property>
<name>org.zkoss.zul.theme.fontSizeXS</name>
<value>9px</value>
</library-property>
Font Family
Deprecated since 7.0.0
The following library properties control the font family.
org.zkoss.zul.theme.fontFamilyT | Default: Verdana, Tahoma, Arial, Helvetica, sans-serif
The font family used for titles and captions. |
org.zkoss.zul.theme.fontFamilyC | Default: Verdana, Tahoma, Arial, serif
The font family used for contents. |
Add Additional CSS
If you want to customize certain components, you can provide a CSS file to override the default setting. For example, if you want to customize the look and feel of the a component, you can provide a CSS file with the following content.
.z-a-disd {
color: #C5CACB !important;
cursor: default!important;
text-decoration: none !important;
}
.z-a-disd:visited, .z-a-disd:hover {
text-decoration: none !important;
cursor: default !important;;
border-color: #D0DEF0 !important;
}
Then, specify it in WEB-INF/zk.xml as follows.
<desktop-config>
<theme-uri>/css/my.css</theme-uri>
</desktop-config>
For more information, please refer to the ZK Style Guide.
Version History
Version | Date | Content |
---|---|---|