What is the Theme Helper?

Theme Helper is a sigleton class that simplifies themes switching and allows getting the current theme name.

ThemeHelper helper = ThemeHelper.getInstance();

// diaplay a name of the current theme
Window.alert("Current theme is " + helper.getThemeName());

// change theme to "gray"

// diaplay a name of the current theme again
Window.alert("Current theme is " + helper.getThemeName());


How to create a custom theme?

The simpliest way to create a custom theme is to copy one of existing themes. A new theme must consist of theme.css file and custom images. The CSS file must be placed in the GWT module folder public/advaced/themes/<name_of_your_theme>/ . For images you should create any folder you want and use relative paths in the CSS file. Usually all images are placed in the same folder.


How to switch look & feel using themes?

If you use several themes you can switch look & feel using ThemeHelper API. See What is the Theme Helper? for details.


How to change look & feel of widgets that is not covered by CSS features?

Widgets that need this option must implement the ThemeApplicable interface and must be register in the ThemeHelper with the ThemeHelp.register() method.

Every time when theme is chnaged the helper invokes the apply() method of registered widgets.