[[custom-bootstrap-theme]]
= Custom Bootstrap theme

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.



The Apache Isis Wicket viewer uses http://getbootstrap.com/[Bootstrap] styles and components, courtesy of the https://github.com/l0rdn1kk0n/wicket-bootstrap[Wicket Bootstrap] integration.

By default the viewer uses the default bootstrap theme.
It is possible to configure the Wicket viewer to allow the user to xref:vw:ROOT:setup-and-configuration.adoc#themes[select other themes] provided by http://bootswatch.com[bootswatch.com], and if required one of these can be xref:refguide:config:sections/isis.viewer.wicket.adoc#isis.viewer.wicket.themes.initial[set as the default].

However, you may instead want to write your own custom theme, for example to fit your company's look-n-feel/interface guidelines.
This is done by implementing https://github.com/l0rdn1kk0n/wicket-bootstrap[Wicket Bootstrap]'s `de.agilecoders.wicket.core.settings.ITheme` class.
This defines:

* the name of the theme
* the resources it needs (the CSS and optional JS and/or fonts), and
* optional urls to load them from a Content Delivery Network (CDN).

To make use of the custom `ITheme` the application should register it by subclassing `IsisWicketApplication` (also register this in `web.xml`) and add the following snippet:

[source,java]
----

public void init() {
    ...
    IBootstrapSettings settings = new BootstrapSettings();
    ThemeProvider themeProvider = new SingleThemeProvider(new MyTheme());
    settings.setThemeProvider(themeProvider);
    Bootstrap.install(getClass(), settings);
}
----



