Skip to content

Create Theme

Frieder Reinhold edited this page May 28, 2021 · 3 revisions

Basically a theme is a plugin.

Create an empty plugin

See Create-a-plugin

Provide an extension point for each theme contained in your plugin

@Extension
public class MySpecialThemeProvider extends BaseThemeProvider implements ThemeProvider, ThemeProviderHook {
    @Override
    public String getName() {
        return "MySpecial";
    }

    @Override
    public String getCss() {
        return getCssFromInputStream(MySpecialThemeProvider.class.getResourceAsStream(getName() + ".css"));
    }

    @Override
    public IconMode getIconMode() {
        return IconMode.WHITE; // Decide if you need the white or the black icons.
    }
}

Add CSS

For each plugin you must provide a css file in the resources folder in the same namespace as your extension point.

So for src/main/java/org/correomqtt/plugin/myspecial/MySpecialThemeProvider.java you must provide src/main/resources/org/correomqtt/myspecial/MySpecial.css.

The easiest way to learn about how to style CorreoMQTT is to take a look to the existing themes. The default dark and light theme is located here: default themes If you want to create a cleaner, modern and flat look a good starting point is the port of the kde plasma theme breeze that is located here: farion theme pack