Theme System
Theme System
The UI bundle provides 7 complete themes implemented via CSS custom properties on the data-theme HTML attribute.
Theme preference persists across sessions via cookie.
A two-part FOUC prevention strategy ensures the page never flashes with the wrong theme.
Theme Registry
| Theme | Slug | Accent Colors | Notes |
|---|---|---|---|
Dark (default) |
|
|
Default theme, professional medical/tech aesthetic |
Catppuccin Mocha |
|
|
Based on the Catppuccin Mocha palette |
Light |
|
|
Clean light mode for bright environments |
Royal |
|
|
Deep purple/magenta with crown star icon |
Aurora |
|
|
Northern Lights gradient inspiration |
Ocean |
|
|
Deep sea blues with bioluminescent accents |
Ember |
|
|
Warm hearth with fire gradient for deep focus |
CSS Custom Properties Architecture
All themes are defined in src/css/domus-theme.css (2,383 lines).
Each theme is scoped under a [data-theme="slug"] attribute selector:
[data-theme="dark"] {
--bg-primary: #1a1a1a;
--bg-secondary: #252525;
--text-primary: #e0e0e0;
--accent-primary: #0077B6;
--accent-secondary: #00B4D8;
}
Every theme defines the full variable set: backgrounds, text colors, accent colors, code block styling, table styling, admonition colors, sidebar gradients, and component-level overrides. This ensures zero visual leakage between themes.
Cookie Persistence
-
Cookie name:
antora-theme -
Expiry: 1 year (
max-age=31536000) -
Flags:
SameSite=Lax,path=/ -
Default:
dark(when no cookie exists) -
Helpers:
getCookie()/setCookie()insrc/js/vendor/domus-ui.js
FOUC Prevention
Two-part strategy prevents Flash of Unstyled Content on page load:
Part 1 — Early theme detection (src/partials/head-styles.hbs):
An inline <script> block executes before the CSS <link> tag.
It reads the antora-theme cookie and sets data-theme on <html> immediately:
(function() {
var t = getCookie('antora-theme') || 'dark';
document.documentElement.setAttribute('data-theme', t);
})();
Part 2 — CSS gating:
The CSS rule html:not([data-theme]) { visibility: hidden; } hides the page until the data-theme attribute is applied.
Once the inline script sets it, the page becomes visible with the correct theme already active.
Theme Toggle UI
Implemented in src/js/vendor/domus-ui.js (lines 36-59):
-
Position: Fixed, bottom-right corner (24px offset)
-
Style: Glassmorphism pill with backdrop blur, gradient background, 1px semi-transparent border
-
Behavior: Click cycles through all 7 themes sequentially
-
Display: SVG icon + label (e.g., moon icon + "Dark")
-
Each theme has a unique SVG icon: moon, smiley face, sun, star, checkmark gradient, waves, fire gradient
Adding a New Theme
-
Define a
[data-theme="newname"]block insrc/css/domus-theme.csswith all required CSS custom properties -
Add
'newname'to thethemesarray insrc/js/vendor/domus-ui.js -
Add an SVG icon to
themeIconsobject -
Add a display label to
themeLabelsobject -
Rebuild:
npx gulp bundle
Source Files
| File | Lines | Purpose |
|---|---|---|
|
2,383 |
All 7 theme definitions + premium styling (gold sidebars, exec tables, code blocks) |
|
182 |
Theme toggle logic, icon/label cycling (lines 22-59) |
|
12 |
FOUC prevention inline script + CSS link tag |