You can use these as base template for developing a Keycloak theme locally.
- Create a folder for your custom theme within the
src/main/resources/themesdirectory, if one does not already exist. - Then add a subdirectory for the theme type (e.g.
email,login, etc.). - Modify the themes manifest in
src/main/resources/META-INF/keycloak-themes.jsonto add your theme name (also the directory name. - Make a
theme.propertiesfile in your theme's directory. Use the template here as an example. - Modify any of the files within your custom theme directory. Assuming you are extending the
baseorkeycloaktheme, you only need to override the files you want to change. - To easily iterate without having to restart the server every time, load keycloak using
start-devwith the included docker-compose file caching off:docker compose up
- You can easily override the emails here by setting
parent=baseand it is only necessary to override the templates you want to change. - Override only the template.ftl to wrap the existing messages with your branding/chrome. There is an example of this in the repository.
- Almost all message content overrides happen in the
messages/messages_<locale>.propertiesfiles.
- Login to the admin console at
http://localhost:8080/auth/adminwithadmin:admin - Go into
Realm Settings->Themesand select the theme you are working on (e.g. Login->example)
- Run
mvn packageto build a jar that can be placed in theprovidersdirectory of your Keycloak installation.