# Custom Themes with Keycloak 17

**URL:** <https://forum.keycloak.org/t/custom-themes-with-keycloak-17/13786>\
**Category:** Extending the server\
**Created:** [February 22, 2022, 10:12am UTC](https://forum.keycloak.org/t/custom-themes-with-keycloak-17/13786 "2022-02-22T10:12:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmthn](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tmthn/32/5124_2.png) [@tmthn](https://forum.keycloak.org/u/tmthn)\
**Post date:** [February 22, 2022, 10:12am UTC](https://forum.keycloak.org/t/custom-themes-with-keycloak-17/13786/1 "2022-02-22T10:12:13Z")

</div>

Hey,

i wanted to upgrade my local development Keycloak instance to version 17, but can’t get the custom themes to work when started in dev mode. I deploy my custom themes with docker-compose by mounting the theme via a volume into the container. This works flawlessly in version 16, but when using the new Quarkus edition the mounted theme directory is ignored. Does anyone have similar problems?

Thanks!

**Update**  
Found the problem. I used the wrong path. The jboss image is using a different directory structure.

With the jboss image:

`/opt/jboss/keycloak/themes/custom-theme/`

With the official image from [quay.io](http://quay.io):

`/opt/keycloak/themes/custom-theme/`

---

<div class="post-metadata">

**Author:** ![mbuchner](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/mbuchner/32/5089_2.png) [@mbuchner](https://forum.keycloak.org/u/mbuchner)\
**Post date:** [February 22, 2022, 11:49am UTC](https://forum.keycloak.org/t/custom-themes-with-keycloak-17/13786/2 "2022-02-22T11:49:32Z")

</div>

There is a README file in this directory explaining the available options - I also struggled finding documentation about it:

```auto
Themes are used to configure the look and feel of login pages and the account management console.

Custom themes packaged in a JAR file should be deployed to the `${kc.home.dir}/providers` directory. After that, run
the `build` command to install them before starting the server.

You are also able to create your custom themes in this directory, directly. Themes within this directory do not require
the `build` command to be installed.

When running the server in development mode using `start-dev`, themes are not cached so that you can easily work on them without a need to restart
the server when making changes.

See the theme section in the [Server Developer Guide](https://www.keycloak.org/docs/latest/server_development/#_themes) for more details about how to create custom themes.

Overriding the built-in templates
---------------------------------

While creating custom themes, especially when overriding templates, it may be useful to use the built-in templates as
a reference. These can be found within the theme directory of `../lib/lib/main/org.keycloak.keycloak-themes-17.0.0.jar`, which can be opened using any
standard ZIP archive tool.

```

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [February 22, 2022, 11:53am UTC](https://forum.keycloak.org/t/custom-themes-with-keycloak-17/13786/3 "2022-02-22T11:53:03Z")

</div>

You need to package it as a jar for the Quarkus/17 version.

See the README in `/opt/keycloak/themes/README.md`:

> Custom themes packaged in a JAR file should be deployed to the `${kc.home.dir}/providers` directory. After that, run  
> the `build` command to install them before starting the server.

This project will build a jar in the correct format, if you need to see how the packaged result it laid out. [GitHub - p2-inc/keycloak-theme-template: Starter for building a Keycloak theme](https://github.com/p2-inc/keycloak-theme-template)

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [February 22, 2022, 12:01pm UTC](https://forum.keycloak.org/t/custom-themes-with-keycloak-17/13786/4 "2022-02-22T12:01:09Z")

</div>

There‘s no need to package a theme as a jar, I just use regular directory structures, like I did already with KC legacy, and it works flawelessly. Of course you have to use the proper path, but no need for a jar for custom themes.

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [February 22, 2022, 2:03pm UTC](https://forum.keycloak.org/t/custom-themes-with-keycloak-17/13786/5 "2022-02-22T14:03:48Z")

</div>

Thanks. I just assumed from the new docs that it had to be a jar.

---

<div class="post-metadata">

**Author:** ![d.lmnn](https://avatars.discourse-cdn.com/v4/letter/d/85f322/32.png) [@d.lmnn](https://forum.keycloak.org/u/d.lmnn)\
**Post date:** [March 30, 2022, 12:55pm UTC](https://forum.keycloak.org/t/custom-themes-with-keycloak-17/13786/6 "2022-03-30T12:55:11Z")

</div>

Unfortunately, I could not make it work. Here is what I tried:

In the folder `./themes/mytheme`, there are the following files:

```auto
./META-INF/keycloak-themes.json
./theme/mytheme/login/theme.properties

```

With the content of the keycloa-themes.json file:

```auto
{
    "themes": [{
        "name" : "mytheme",
        "types": ["login"]
    }]
}

```

And the theme.properties content:

```auto
parent=base
import=common/keycloak
...

```

When I start the server, the new theme is not available for selection on the user interface.

```auto
» bin/kc.sh start-dev

```

Any hint is highly appreciated 🙂, Thanks.

---

<div class="post-metadata">

**Author:** ![sdenovan](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/sdenovan/32/5603_2.png) [@sdenovan](https://forum.keycloak.org/u/sdenovan)\
**Post date:** [April 14, 2022, 8:35pm UTC](https://forum.keycloak.org/t/custom-themes-with-keycloak-17/13786/7 "2022-04-14T20:35:13Z")

</div>

You can extend themes for different parts of Keycloak but assuming that you’re modifying login related content your theme content would go:

`/opt/keycloak/themes/THEME_NAME/login`

The THEME\_NAME directory is empty except for the login subdirectory. Inside the login subdirectory, you’ll have something like:

```auto
-rw-r--r-- 1 keycloak 1000 1181 Apr 14 13:12 login.ftl
drwxr-xr-x 2 keycloak 1000 3 Apr 1 07:32 messages
drwxr-xr-x 6 keycloak 1000 6 Apr 1 07:32 resources
-rw-r--r-- 1 keycloak 1000 8045 Apr 1 10:23 template.ftl
-rw-r--r-- 1 keycloak 1000 661 Mar 31 14:23 theme.properties

```

The contents will depend on what you have chosen to override from the default Keycloak theme. Also make sure your theme directory is readable by Keycloak. For container deployments that means UID 1000 (which is the keycloak user inside the container)
