How to disable theme selection

Still need help?

The Atlassian Community is here for you.

Ask the community

Purpose

When you want all spaces to follow the global look and feel, this page describes a way of preventing your space administrators from changing the theme in a space. 

Customisations are not supported

Note that Atlassian support does not cover customisations to Velocity files, such as those described on this page.

tip/resting Created with Sketch.

All files should be located under <confluence-install>\confluence\spaces.

Solution

Removing the Theme Selection Option

To remove the option that allows people to select a theme for a space, you will need to edit the Velocity template (.vm file) as described below.

  1. Locate your choosetheme.vm file under

    <confluence_install>\confluence\spaces\choosetheme.vm
  2. Edit this file with your favorite editor, such as Wordpad, Notepad or Notepad++ (recommended). The file looks something like this:

    <html>
    	<head>
    		<title>$action.getActionName($action.getClass().getName())</title>
        </head>
    
        #applyDecorator("root")
            #decoratorParam("helper" $action.helper)
            #decoratorParam("context" "space-administration")
            #decoratorParam("mode"  "view-space-administration")
            #decoratorParam("help-path" "/spaces/help/choosetheme.vm")
    
            <body>
                #applyDecorator ("root")
                    #decoratorParam ("context" "spaceadminpanel")
                    #decoratorParam ("selection" "choosetheme")
                    #decoratorParam ("title" $action.getActionName($action.getClass().getName()))
                    #decoratorParam ("selectedTab" "admin")
                    #decoratorParam("helper" $action.helper)
    
                    <form method="POST" action="dochoosetheme.action" name="choosethemeform">
                        #form_xsrfToken()
                        #parse ("/includes/common-choosetheme.vm")
                        <input type="hidden" name="changesSaved" value="true">
                        #tag ("Submit" "value='confirm.name'" "align='center'" "theme='notable'" "template='submit.vm'")
                    </form>
                #end
            </body>
    
        #end
    </html>
    
  3. Add a comment, as shown below, replacing the block that starts with "<form method..." and ends with "</form>". After the edit, you should have something like this:

    <html>
    	<head>
    		<title>$action.getActionName($action.getClass().getName())</title>
        </head>
    
        #applyDecorator("root")
            #decoratorParam("helper" $action.helper)
            #decoratorParam("context" "space-administration")
            #decoratorParam("mode"  "view-space-administration")
            #decoratorParam("help-path" "/spaces/help/choosetheme.vm")
    
            <body>
                #applyDecorator ("root")
                    #decoratorParam ("context" "spaceadminpanel")
                    #decoratorParam ("selection" "choosetheme")
                    #decoratorParam ("title" $action.getActionName($action.getClass().getName()))
                    #decoratorParam ("selectedTab" "admin")
                    #decoratorParam("helper" $action.helper)
    
    		   <h1>Dear Space Administrator,</h1><br>
    		   <p><font size="3" color="red">You cannot change this  Theme, we took so much effort building our Theme.<br>
                    Please continue to use the Global Look and Feel<br>
                    If you have any complains contact the Admin.<br>
                    Regards your Admin.<br></font></p>
    
                #end
            </body>
    
        #end
    </html>
    
  4. Save the file. You can reload your page and see the changes. There is no need to restart Confluence.

After following the above steps, you will have something like this:

Last modified on Jul 22, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.