Documentation

Custom themes

Documentation
On this page

Okivo's pages in Keycloak (device setup, sign-in approval) and the invitation email appear in your realm's theme. With Keycloak's own themes (keycloak.v2, keycloak) this works out of the box. If you build your own login or email theme, keep the points below in mind.

A complete example with a check script, a local Keycloak to try it and a brief for AI coding tools is on GitHub: okivo-keycloak-theme-demo (MIT license). Use the branch of your Keycloak version, for example keycloak-26.7.

Device setup in the demo theme “Acme”

Login theme

  • Keep the page frame. template.ftl must provide the macro registrationLayout with the sections header and form and show Keycloak's messages. The easiest way is to inherit template.ftl from keycloak.v2.
  • Do not copy Okivo's pages. Do not put push-mfa-*.ftl into your theme. A copy freezes the page at the current plugin version; later improvements no longer reach your users. Style the pages with CSS and change texts in messages_<language>.properties.
  • Buttons. Set kcButtonClass, kcButtonPrimaryClass, kcInputClass and both kcButtonSecondaryClass and kcButtonDefaultClass in theme.properties.
  • QR code. Dark on white with a margin, also in dark mode; do not recolor or invert it.
  • JavaScript. The pages need small scripts (QR code, copy, waiting for the approval). A Content-Security-Policy without 'unsafe-inline' in script-src breaks device setup.

Email theme

The invitation (“Set up Okivo” under Credentials → Credential reset) comes from the email theme okivo in the plugin. Set parent=okivo in your email theme: the invitation keeps working and everything else follows your theme. Change its texts with the keys okivoInvite… in messages_<language>.properties.

Check

The demo repository has a test checklist and the script tools/check-theme.sh, which checks your theme against these rules. Walk through the checklist in a browser, light and dark, on a phone and a computer, in every language of your realm. All selectors and message keys are in the theme contract.