How do I add custom properties to a theme?

I know that custom colors schemes can be added to a custom theme (which would let admins select between multiple color schemes) - can I add other custom properties? For example, I’d like to add the ability to type in a name (a dropdown would be even better, but that’s not critical) to switch between custom headers between spaces. If this is possible, how do I reference them in my theme? I’d love to be able to look this stuff up, but there’s REALLY sparse documentation on building custom themes.

There isn’t a way to do this that is specific to themes so to speak. But essentially what you need to do is create a screen in either Space Tools or the global configuration where an admin can configure stuff. There is nothing predefined which will tie this in with your theme directly so you need to handle that yourself in the code. You want to make a configuration screen for your app and you might want it to be space specific because by nature theme’s are applied on a space by space basis.

Don’t think of it as custom theme properties at a low level. You are first going to implement a way to store and retrieve custom settings in the database based on user input in some kind of GUI. Secondly you will make your theme code retrieve those settings and change its behaviour as a result. The implementation of configuration itself is basically decoupled from the concept of a theme in Confluence.

Tutorial on writing a configuration screen in an app. It’s perhaps a bit dated, but generally will do what you need it to:

Tutorial on rendering a screen within Space Tools which I’m assuming you may want to do:

1 Like