Creating a Stylesheet Theme
To create a stylesheet theme, you need to first create your custom stylesheet for Confluence. You can do this using many CSS editing tools. See Styling Confluence with CSS for more information.
Once you have a stylesheet (and optionally images) ready, this guide will show you how to package up your stylesheet for use in Confluence as a theme.
The quick demonstration is the Easy Blue theme, which you can download here:
You can quickly customise this theme by using a ZIP extractor program (like WinZip, 7-Zip, etc.) to extract the files, change them, then zip it back up into a JAR file and install it in Confluence.
Since this theme was developed as a quick stylesheet demonstration for Confluence, it only has limited browser support. See Easy Blue Stylesheet for information about which browsers are supported.
The remainder of this document is a walk-through which describes in detail how to create a theme like this from scratch.
Creating the descriptor file
Each theme plugin needs a plugin descriptor file, called
atlassian-plugin.xml. For themes with a single stylesheet, the file is very simple. Below is an example with one stylesheet.
To create your new theme from scratch:
- Copy the above XML into a new text file
- Customise the key, name and vendor of your theme throughout the file
- Don't change the class in the
- In the
<resource>tag, put the name of your stylesheet in both the
- Save the customised XML file as
atlassian-plugin.xmlin a new directory with your stylesheet.
Packaging the theme
The theme files need to be put into a JAR file. A JAR file is essentially a ZIP file with a
.jar extension, so you can create it with whatever tool you like.
To use the command-line tool,
jar, which ships with the Java Development Kit, you can run the following command in the directory with your files:
This will wrap up the
atlassian-plugin.xml file with whatever images and CSS files you have in your directory. Now you can upload the plugin into Confluence.
Now you're done! If your theme is working great now, then you're finished. There might be a few more things you need to know, however. The later sections cover these details about further customisation of your stylesheet theme.
Including the default stylesheet
Most themes that you write for Confluence will actually rely on the default theme stylesheets in Confluence. This includes the standard Confluence fonts, colours, and many other things. To include the Confluence styles in your theme, the
<theme> tag in your plugin needs to include Confluence's default stylesheet as a resource:
For many themes, you will want to pull in custom background images, icons, and so on. This is very easy to do:
- Put the images in the same directory as your CSS and
- Add a resource to your theme descriptor XML file for the image:
Images in subdirectories (optional)
You can put your images into a subdirectory within your theme if you want to:
Note that when you reference that file in your CSS, you simply use the name and not the path in the location. For this example:
Theme icon image (optional)
To polish off your new theme, you can create a theme icon for the "Choose Theme" menu (displayed next to your theme's name and description). If you don't set your own icon, a default image will be shown. Your theme will work either way.
To create a theme icon:
- make a 110px × 73px .gif which represents your theme
- add the image to your theme
- set the
locationattribute (but don't change the
name) with the following
Here's a listing of the files in the source of the Easy Blue theme (demonstrated above):
These are all zipped up into the easy-blue-theme-1.1.jar file which can be installed into Confluence. In fact, the JAR file is almost exactly the same as the ZIP file. The only difference is a manifest file generated automatically by the
jar command line tool, which is completely unnecessary for your theme to work in Confluence.
Here's the plugin descriptor file:
You should ensure you update the plugin details if you copy this example.