Improvements #9115

Set the version in WBootstrapTheme C'tor

Added by Rathnadhar K V over 1 year ago. Updated 5 months ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
1.50 h



Currently I create a BootstrapTheme object and then set the them version as follows:

auto btheme_ptr = std::make_shared<Wt::WBootstrapTheme>();
btheme_ptr->setVersion (Wt::BootstrapVersion::V3);


can we make it more robust as :




If I have to add my own theme then...


that way I can have clean interface to set the theme for the page/widget.

Its preferable to set the pass to css that we have the flexibility to define our own themes in self contained directory.

Rathnadhar K V


Updated by Roel Standaert over 1 year ago

  • Target version set to future

We were actually refactoring the Bootstrap theme to be split up in multiple classes, so WBootstrap2Theme, WBootstrap3Theme, WBootstrap4Theme, and WBootstrap5Theme, since they end up being dissimilar enough to warrant their own class.

The theme directory may be something we can take into consideration.


Updated by Rathnadhar K V over 1 year ago

Namaskara Roel,

That is wonderful.

May I suggest an improvement,

Have a common glue CSS class....WThemeContainer()....(name just a example, you can call it whatever you deem fit).

Now to this WThemeContainer class I add backend (s) ....WBootstrap2Theme ...WBootstrap5Theme....

Say I can add max of 8 backends.

int index = WThemeContainer(WBootStrap5Theme,responsive=true,path=path_to_css_file);

index 0 is fixed for Wt.css (fall back option) in case other css are not added.

Now WTheme class will have virtual member functions that is implemented by other CSS classes....

that way I can add any bootstrap similar theme easily ....

so in the application, only WThemeContainer is visible and based on index I get the css classes...

That way my WApplication is decoupled from back end theme....and I can easily add other frameworks' themes.

Rathnadhar KV


Updated by Rathnadhar K V over 1 year ago

Instead of index as int, you can even get a iterator to the theme within the container.


Updated by Roel Standaert 5 months ago

  • Status changed from New to Closed
  • Target version deleted (future)

I'm closing this since we now have separate Bootstrap classes.

Your idea does not seem feasible to me (or I don't quite understand it), since it's more than just CSS. The theme directly affects what HTML is being generated for the widgets.

Also available in: Atom PDF