Styling with a theme

A theme provides the look and feel of several built-in widgets, using CSS style rules. The rules for each CSS theme are defined in the folder resources/themes/. There each theme is organized in a sub folder.

You can choose from three themes:

You don't have to do anything to use this theme from the WCssTheme class as it is the default theme.
This theme is also implemented by the WCssTheme class. You can change to this CSS theme with setCssTheme("polished") in your WApplication.

There are three versions of this theme, implemented through the WBootstrap5Theme, WBootstrap3Theme, and WBootstrap2Theme classes. They rely on the Bootstrap CSS framework. Use setTheme(std.make_shared<WBootstrap5Theme>()) to use this theme.

As of version 4.6.0, Bootstrap versions 2, 3, and 5 are supported. Prior to 4.6.0 there was WBootstrapTheme, which is now deprecated in favor of WBootstrap2Theme, WBootstrap3Theme, and WBootstrap5Theme. The widget gallery has been restyled to use Bootstrap 5.
While the theme makes sure that JWt's widgets are rendered with the markup expected by bootstrap, there are many features that are particular to the layout system of bootstrap (and were changed between various versions of Bootstrap). Thus, you need to know how bootstrap expects you to layout widgets in order to effectively use this theme, for which we refer to the Bootstrap documentation.



Setting an empty theme (with parameter "") will result in a stub CSS theme that does not load any stylesheets.