⚡ Theme Designer Pro (Event Function)
Instance-wide theme designer for Open WebUI — standalone admin page with server-side persistence, SSE live push, draft mode, and real-time theme enforcement across all users.
Important
Event Function vs. Tool — Which should you use?
Theme Designer Pro is available in two forms that target different audiences:
Event Function (this file) Tool Target audience Server administrators Individual users Storage Server-side file persistence (instance-wide) Browser localStorage(per-user, per-browser)Theme scope Global — applies to all users on the instance Personal — only affects your own browser Requires admin Yes No SSE live push Yes — all connected clients update in real-time No Draft mode Yes — preview before publishing No Community Themes browser Yes — curated themes with one-click install No Sidebar / overlay transparency Yes — admin-controlled visual style valves No Multi-worker support Yes — automatic Redis pub/sub for multi-worker SSE No AI-driven theming No Yes ( apply_theme()tool method)Development status Actively developed Maintenance mode Both versions share the same core functionality — OKLCH palette engine, Canvas FX, gradient builder, custom CSS, and snapshot library.
If you're an admin looking for instance-wide theming, this Event Function is for you. Add the optional Launcher Tool companion to open the designer directly from chat.
If you're a regular user who wants personal theme customization without admin access, use the Tool variant.
Theme Designer Pro (Event Function) is a professional-grade theming engine for Open WebUI. It registers a standalone admin page at a configurable URL (default: /api/v1/theme-designer), persists themes server-side, and pushes changes to all connected clients in real-time via Server-Sent Events. Powered by the modern OKLCH color space, it generates perceptually uniform color palettes across Dark, OLED, Light, and Her modes simultaneously.
Unlike the Tool variant which runs inside an AI chat iframe, this variant runs as a native ASGI route — no iframe sandbox flags needed, no "Same Origin" configuration required.
✨ Key Features
-
⚡ Server-Side Persistence: Themes are saved to
DATA_DIR/theme/on the server and served through Open WebUI's shared static assets (/static/loader.js+/static/custom.css) — every user sees the same theme instantly, across all browsers and devices. Nothing is written to the frontend build. -
📡 Real-Time SSE Push: When you save a theme, all connected Open WebUI clients receive the update in real-time via Server-Sent Events. No page refresh required. Multi-worker deployments are supported via automatic Redis pub/sub broadcasting.
-
📝 Draft Mode: Preview theme changes locally in your browser before publishing to all users. Draft mode isolates changes in
sessionStorage— other users see nothing until you publish. The designer communicates with the bootloader via aowui-theme-updatedCustomEvent for live preview without touchinglocalStorage. Click Publish to push to all users, or discard to revert. -
🌈 OKLCH Color Engine: Harness Tailwind v4's OKLCH color spaces. Adjust Hue, Chroma, and Lightness to generate mathematically perfect, accessible tonal ramps. Hit ✦ Randomize to generate random base colors instantly, or ◎ Extract to upload/paste an image and calculate dominant colors using hue-histogram analysis. Locked variables are protected from both. (Pro-Tip: Double-click any slider label to instantly reset it to its default value).
-
🖥️☀️🌌🌙❤️ Multi-Mode Design Engine: Switch between System, Dark, OLED, Light, and the elusive Her mode design views using the segmented toggle. A unified OKLCH foundation ensures your colors look mathematically perfect across all environments. (Note: The 'Her' tab dynamically reveals itself by syncing with your Open WebUI administrator's
enable_easter_eggsconfiguration via the/api/configendpoint). -
🌓 True OS Integration & System Mode: The System mode acts as a proxy, automatically swapping between your Light and Dark designs based on Operating System preference. The engine generates CSS utilizing native
@media (prefers-color-scheme)blocks, guaranteeing custom styles, variables, and Canvas FX seamlessly adapt even if browser class management is delayed. -
🔄 Selective Cross-Mode Synchronization: Instantly duplicate your setup from one mode to another using the "Sync" button. A powerful selective sync modal allows you to copy exactly what you need — OKLCH Palette, Variable Overrides, Custom CSS, Canvas FX, Gradient Background, or Auth Visibility — to any combination of target modes simultaneously. Colored delta badges show which settings differ between modes.
-
🔄 Live Cross-UI Detection: If you change the Open WebUI theme natively (via OS settings or keyboard shortcuts) while the designer is open, the designer instantly switches its internal tab to match your live environment.
-
🔑 Auth Page Theming: Selectively opt-in your custom theme components (Foundation Colors, Custom CSS, Canvas FX, and Gradient Background) to display on the Open WebUI Login and Signup screens. Each component has an independent "Show on Auth Pages" toggle.
-
🎇 Canvas FX Animations (Web Worker Powered): Inject interactive JavaScript animations directly into the background of Open WebUI. Animations run on a Background Web Worker via
OffscreenCanvasfor zero-lag performance, with an automatic main-thread fallback for browsers that don't supportOffscreenCanvas. The structural transparency layer makes native UI panels see-through so animations show behind the interface. Drag & drop.jsfiles anywhere on the UI to import animations instantly. -
🔊 Context-Aware Animations: Canvas FX scripts can react to conversation data in real-time. A DOM observer scans chat messages for DOM-based token estimation (~2s debounce), while a Socket.IO WebSocket interceptor extracts exact token counts from
chat:completionresponses — both feed acontextmessage to the animation for data-driven visual effects. External scripts can also dispatch custom context data via theowui-canvas-contextCustomEvent API. -
🎭 Community Themes Browser: Browse and install curated community themes directly from the Themes tab. The community themes grid fetches from the preset gallery manifest and supports one-click install, install-all, and search. Controlled by the
enable_community_themesvalve. -
🪟 Sidebar & Overlay Transparency: Admin-configurable transparency for the sidebar and overlay UI (settings modals, dropdowns). Choose between opaque (solid), translucent (frosted glass with backdrop-blur), or transparent modes via the
sidebar_transparencyandoverlay_transparencyvalves. -
👩💻 IDE-Grade Custom CSS Editor: Write raw CSS directly within the tool. The editor features Tab trapping (2-space indent), smart auto-indentation, auto-closing pairs (brackets, quotes, parentheses), and a synced line number gutter. Save your favorite tweaks to the built-in Custom CSS Preset Gallery. A bundled "Tactical HUD" CSS preset — designed to pair with the "Tactical Liquid Grid" Canvas FX animation — ships with every fresh install as a starter example. Includes a smart parser that safely extracts and hoists
@keyframes! -
🛡️ Auto-Scoped CSS Injection: Write Custom CSS without fear of breaking other modes. The Auto-Scope toggle automatically wraps your code in the correct CSS selectors (e.g.,
.darkor[data-theme='light']) to ensure tweaks only apply when they should. User CSS is automatically sanitized to prevent spoofing of internalOWUI_*marker comments used for auth-page stripping. -
🎯 Variable Overrides & Manual CSS Variables: Hand-pick and override color variables with a native color picker — each swatch features an
Aacontrast preview badge. Click directly on any variable name to instantly copy its CSS declaration (e.g.,--color-gray-800: #1a1a2e;). The Manual Variable Overrides code editor lets you write raw CSS custom property declarations injected after the generated palette for maximum priority. -
🔒 Smart Locking / Pinning: Lock specific color variables using the 🔒 icon (or bulk "Lock All" / "Unlock All" buttons). Locked colors are pinned and protected from sliders, randomization, or image extraction.
-
📋 Smart Clipboard Parsing & Image Extraction: Upload an image or press
Ctrl+Vto paste one from your clipboard to calculate dominant colors. The tool also features a Smart JSON paste listener — paste a Theme Designer JSON configuration, and the tool will parse and prompt you to apply it (with a security warning if untrusted Canvas FX scripts are detected). -
🎨 Gradient Background Builder: Design rich CSS gradient backgrounds using the dedicated Gradient tab. Choose between linear, radial, and mesh gradient types, add and position color stops visually, control direction and intensity, and enable smooth gradient animation with configurable speed. Ships with 12 built-in gradient presets — Midnight, Emerald, Amethyst, Sapphire, Aurora (animated), Sunset, Ocean, Neon, Nebula (mesh), Lagoon (mesh), Ember (mesh), and Arctic (mesh). Save, import, and export custom gradient presets. The gradient layer applies the same structural transparency rules as Canvas FX.
-
📋 Theme Metadata & Versioning: Attach rich metadata when saving — Name, Description, Author, Theme Version, Target WebUI Version, Repository URL, and Theme Update URL. Metadata is embedded in exported
.jsonfiles and preserved through imports. -
🔄 OTA Theme Update Checking: Themes with a Theme Update URL can be checked for updates against a remote JSON endpoint. Use the per-snapshot ⟳ button or the global "Updates" header button to check all themes at once. Shows a detailed update modal with version comparison.
-
🌐 Community Theme Import via URL: Import themes directly from the web. The Import button opens a dual-mode dialog where you can paste a URL to a remote
theme.jsonfile, or use the classic file picker. Theme Designer Pro auto-convertsgithub.comURLs to raw content. -
📦 JSON Viewer: Inspect your current theme state at any time. The JSON Viewer modal displays your full configuration in a read-only, formatted code block with Copy, Collapse, and validity badge indicators.
-
📚 Theme Library & Snapshots: Save multiple "Snapshots" of your designs. Each snapshot captures your entire configuration (all modes, overrides, locks, manual variables, custom CSS, Canvas FX, and gradient background). Manage your library with inline Save, Import, Export, and Search buttons.
-
🔍 Library Search, Filter & Sort: Find saved themes using search, filter by feature tags (Custom CSS, Canvas FX, Overrides, Linked/URL themes), and sort alphabetically or by creation order. The same search and filter functionality is available in the CSS Snippet and Canvas Script galleries. Rich tooltips show name, version, author, description, and feature tags.
-
📦 Mass Import, Export & Wipe Portability: Download your entire snapshot library (or individual items) as smart backups. Mass-import via file picker, or drag & drop
.json,.js, and.cssfiles directly anywhere onto the designer window — files are automatically routed to the correct gallery (themes, canvas scripts, CSS snippets, or gradient presets). Each gallery has a "Trash" icon to wipe specific collections. Individual CSS files can also be imported and exported. -
⏪ Undo & Redo History: Step backward and forward through changes using the built-in Undo/Redo footer buttons or
Ctrl+Z/Ctrl+Y/Ctrl+Shift+Zkeyboard shortcuts. PressEscapeto close any open modal, orEnterto confirm the primary action. -
📋 CSS / Tailwind v4 Export: The CSS Output tab provides Raw CSS and Tailwind v4
@themeblock views, each with Minify toggle, Copy to Clipboard, and Download as.cssfile. -
👁️🗨️ Self-Adapting UI & Contrast Protection: The designer interface dynamically themes itself based on the colors you pick. Built-in contrast protection shifts text and border colors to remain legible with ultra-washed-out palettes.
-
🪄 Native Open WebUI Aesthetic: Meticulously designed to feel like a native part of Open WebUI, complete with custom-built, dependency-free tooltips and styled code blocks.
-
📱 Fully Responsive: The designer adapts to mobile screens with three responsive breakpoints (≤768px tablets, ≤480px phones, ≤390px iPhone SE) including icon-only mode for narrow header buttons.
-
💾 Session Persistence: The designer remembers which tab you were on via
sessionStorage, so refreshing the page returns you to exactly where you left off. -
⏪ Legacy Data Migration: Automatically detects legacy data structures and gracefully migrates saved snapshots and active themes to the latest format without data loss.
-
🔌 Function Lifecycle Integration: Toggling the function OFF in the admin panel triggers a clean
function.disable_startedlifecycle event that withdraws the theme CSS from the sharedcustom.css, broadcaststheme-disableto all connected clients, and clearslocalStorage— no page refresh needed. The loader fragment stays published in an inactive state so its SSE connection survives. Toggling back ON triggersfunction.enable_started, which republishes and broadcasts the theme to all clients immediately. Requires Open WebUI v0.11.0 or newer (pre-toggle lifecycle events). -
☢️ Safe Nuclear & Factory Resets: "Reset Mode" and "Global Reset" buttons safely clear all custom styling and restore Open WebUI to its original look. Confirmation dialogs offer pre-wipe backups. Factory Reset under the Documentation tab's Danger Zone permanently wipes all data.
🎭 Preset Gallery
A curated community collection of ready-to-import presets is available at:
🔗 github.com/silentoplayz/theme-designer-pro-presets
Quick Import
Import everything at once — paste this URL into any Import modal and click Load URL:
https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/everything.json
Or import individual categories:
| Bundle | URL |
|---|---|
| All Canvas FX | https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/canvas-fx-all.json |
| All CSS Presets | https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/css-presets-all.json |
| All Themes | https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/themes-all.json |
| All Gradients | https://raw.githubusercontent.com/silentoplayz/theme-designer-pro-presets/main/bundles/gradients-all.json |
You can also import individual presets by pasting any file's GitHub URL directly — Theme Designer Pro auto-converts github.com URLs to raw content.
🚀 Installation
- Open your Open WebUI Admin Panel
- Go to Functions
- Click Create New Function
- Set the Type to Event (not Tool, not Filter)
- Copy the contents of
theme_designer_pro_event.pyand paste it in - Save — the designer is now available at
/api/v1/theme-designer
No sandbox flags required. Unlike the Tool variant, this event function serves a native page via ASGI routes — no iframe, no "Same Origin" configuration needed.
Warning
Running behind nginx or another reverse proxy? You must add
proxy_buffering off;to your nginx location block (or the equivalent for your proxy). Without this, SSE live push events are silently buffered and themes will only appear on the admin's browser — other users and devices will see no changes. This is the #1 deployment issue. See the in-app documentation (📖 Docs → Section 17: Reverse Proxy Configuration) for nginx, Caddy, Apache, and Traefik examples.
Optional: Launcher Companion Tool
The Launcher Tool is a lightweight companion that opens the designer page directly inside an Open WebUI chat via iframe — no need to navigate to the URL manually.
- Go to Workspace > Tools > Create New Tool
- Copy the contents of
theme_designer_pro_launcher.pyand paste it in - Save — now you can ask your AI: "Open Theme Designer Pro" and it renders inside the chat
Note: The Launcher Tool requires the Event Function to be installed and running. It has its own
designer_urlvalve that must match the Event Function'sdesigner_urlvalve.
🛠️ Usage Instructions
- Navigate to the Designer: Open your browser and go to your Open WebUI instance's designer URL (default:
/api/v1/theme-designer) - Design your Theme:
- Use the Segmented Toggle to switch between System, Dark, OLED, Light, and Her mode design views
- Use the Themes tab to browse, install, and manage community themes and saved snapshots
- Use the sliders on the Core Palette tab to adjust your foundation colors, override individual color variables, and lock specific shades
- Hover and click over the Tonal Ramp to quickly copy mathematically generated HEX values
- Switch to the Style Overrides tab to write raw CSS tweaks
- Switch to the Canvas FX tab to inject interactive JavaScript background animations
- Switch to the Gradient tab to design gradient backgrounds using the visual builder
- Use the JSON header button to inspect or copy your full theme state
- Use the Updates header button to check all your themes for available updates
- Draft vs. Live: Toggle the Draft button in the header to preview changes locally before publishing. While in Draft mode, only your browser sees the changes. Click Publish to push to all users.
- All changes auto-save. Every change is debounced (250ms) and automatically persisted server-side via
syncToServer(), then broadcast to all connected clients. In Draft mode,syncToServer()is gated off — changes are previewed locally only.
Pro-Tip for Custom CSS: Not sure what to target? Press F12 (or right-click > Inspect) to open your browser's Developer Tools. Use the element picker to find the exact class names used by Open WebUI (e.g., .chat-bubble or #sidebar).
🎨 Custom CSS: Changing Fonts
You can change the global font family for your entire Open WebUI instance by pasting a CSS rule into the Style Overrides tab.
Set the font on the document root and the form controls, then let it inherit down — form elements (input, textarea, button, select) are listed explicitly because they don't inherit font-family by default. Avoid painting the font onto the universal selector *: it clobbers icon fonts and code/math spans.
1. The "Native OS" Vibe (Uses San Francisco on Mac, Segoe on Windows)
html,
body,
input,
textarea,
button,
select {
font-family:
-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, sans-serif !important;
letter-spacing: -0.01em !important;
}
2. The "Hacker Terminal" Vibe (Forces monospace coding fonts)
html,
body,
input,
textarea,
button,
select {
font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace !important;
}
3. The "Editorial" Vibe (Clean, highly readable Serif font)
html,
body,
input,
textarea,
button,
select {
font-family: 'Georgia', 'Cambria', 'Times New Roman', serif !important;
line-height: 1.65 !important;
}
Paste one of these into the Style Overrides editor for your desired mode, ensure "Enabled" is checked, and watch the UI font transform instantly!
🔧 Valve Configuration
Valves are configured in the Admin Panel under Functions → Theme Designer Pro → ⚙️.
🎛️ Feature Toggles
| Valve | Type | Default | Description |
|---|---|---|---|
| Enable Canvas FX | bool |
true |
Allow Canvas FX (JavaScript background animations). When disabled, the Canvas FX tab is hidden and running animations are suppressed — canvas data is stripped from the saved state and a canvas-stripped update is broadcast. |
| Enable Custom CSS | bool |
true |
Allow the Style Overrides (custom CSS) editor. When disabled, the Style Overrides tab is hidden in the designer UI. |
| Enable Gradient Builder | bool |
true |
Allow the Gradient Background builder. When disabled, the Gradient tab is hidden in the designer UI. |
| Enable Community Themes | bool |
true |
Show the Community Themes browser in the Themes tab. When disabled, the community themes grid is hidden and no manifest is fetched. |
🖌️ UX Policy
| Valve | Type | Default | Description |
|---|---|---|---|
| Enable Auth Page Theming | bool |
true |
Allow theming the login/signup pages. When disabled, all "Show on Auth Pages" toggles are hidden and forced off. |
| Draft Mode Default | bool |
false |
Open the designer in Draft mode by default. When enabled, the designer starts in Draft mode on every fresh page load, preventing accidental live changes. |
| Auto Sync | bool |
false |
Skip the Selective Sync modal when loading presets or syncing. When enabled, a "Sync All" toggle appears in the designer footer — turn it on to propagate changes to all modes, or leave it off to apply only to the active mode. |
🎨 Visual Style
| Valve | Type | Default | Description |
|---|---|---|---|
| Sidebar Transparency | Literal |
"opaque" |
Controls sidebar background style. "opaque" (default) — solid background for best readability. "translucent" — frosted glass effect (backdrop-blur) that lets backgrounds show through. "transparent" — fully see-through sidebar with no blur (automatically uses translucent on mobile for readability). |
| Overlay Transparency | Literal |
"opaque" |
Controls overlay UI (settings modal, dropdowns, integration menus) background style. "opaque" (default) — solid background for best readability. "translucent" — frosted glass effect (backdrop-blur) that lets backgrounds show through. |
🔒 Security
| Valve | Type | Default | Description |
|---|---|---|---|
| Enable Canvas API Access | bool |
false |
⚠️ Gives every Canvas FX script each viewer's own auth token, not just yours. Canvas FX scripts run on every user's page, so a script can call the API as whoever is viewing. Scripts referencing document run on the main thread, outside a Worker's isolation, and an installed theme can replace its script later via its update URL — enabling this trusts every theme author on an ongoing basis. Only enable if you wrote or audited every installed script. When disabled (default), env.authToken is an empty string and everything else works. |
| Enable URL Import | bool |
true |
Allow importing themes, CSS snippets, and canvas scripts from remote URLs. When disabled, all URL import buttons are hidden. |
| Allowed Import Domains | str |
"" |
Comma-separated allowlist of domains for URL imports (e.g., raw.githubusercontent.com, openwebui.com). Empty = allow all. Only applies when Enable URL Import is true. |
🛠️ Advanced
| Valve | Type | Default | Description |
|---|---|---|---|
| Designer URL | str |
/api/v1/theme-designer |
URL path where the designer and all its sub-routes are served. Must start with /api/v1/ — paths outside this prefix are auto-corrected to prevent the SPA catch-all from intercepting the route (a warning is logged). Changing this value triggers a route re-registration; the loader fragment picks up the new URL on its next compose. |
Note: All Valves default to their most permissive values — the event function behaves identically to an un-valved installation out of the box. Admins only need to configure Valves if they want to restrict specific features.
Important
Most valve changes take effect on the next
event()call (i.e., any chat message or function event). Saving valve values alone doesn't trigger re-injection — it happens the next time the event function runs. The exception is the function ON/OFF toggle in the admin panel, which triggersfunction.disable_started/function.enable_startedlifecycle events that take effect immediately (on Open WebUI v0.11.0 or newer).
📖 In-App Documentation
The designer includes 22 comprehensive documentation sections accessible via the 📖 Docs button in the header. These cover:
- Getting Started & Architecture
- OKLCH Foundation & Modes
- System Theme & OS Integration
- Draft Mode & Publishing
- Variable Overrides & Locks
- Custom CSS & Auto-Scoping
- Canvas FX Animations (incl. Worker Protocol & API contract)
- Advanced Tools & Image Extraction
- Libraries & Data Management
- Theme Updates (OTA)
- Reference: Available Variables
- Gradient Backgrounds (incl. preset table)
- Structural Transparency & Layer Stack
- Keyboard Shortcuts & Editor Tips
- Compliance & Legal Disclaimer
- Community Presets (with import URLs)
- Reverse Proxy Configuration 17b. Multi-Worker Deployments
- Troubleshooting & FAQ
- Uninstallation & Complete Removal
- Portability & Backups
- Danger Zone (Factory Reset)
🚀 How It Works (Under the Hood)
Theme Designer Pro persists themes on the server and pushes changes to every connected client. Unlike the Tool variant, which operates through an iframe and browser localStorage, the Event Function publishes into Open WebUI's two admin-extensible static assets and composes them per request.
Changed in 1.7.0. Earlier versions wrote a bootloader and a
<style>block directly into the frontend'sindex.html, under a cross-process file lock. That is gone. See Shared Static Assets below.
-
Event-Driven Publishing: The
event()entry point runs on every Open WebUI event (chat messages, system events) and re-points two fragments at the current function instance: one for/static/loader.js, one for/static/custom.css. Publishing is idempotent and costs two dict writes, so it runs unconditionally — which is also what makes a hot reload converge. Nothing touches the filesystem. -
The Bootloader (composed into
/static/loader.js): A self-contained JavaScript block (~900 lines) that runs on every page load. It handles:- Theme state loading: Reads config from
localStorage+ the state inlined into the loader fragment, then fetches/theme.cssand/state.jsonfrom the server. Both are applied atomically — CSS and state never land separately, so the page can never render one theme's colors against another's canvas. Uses a monotonic version counter to prevent stale fetch responses from overwriting fresher SSE data. - SSE client: Connects to the
/eventsendpoint to receive real-timetheme-updateandtheme-disablemessages. When an update arrives, it applies the new CSS/state immediately — no page refresh needed. Uses nativeEventSourceauto-reconnect with a 3-second retry interval. Includes iOS PWA resilience — re-opens the connection when the app returns to foreground after WebKit silently kills it. - Socket interceptor: Wraps the
WebSocketconstructor to attach amessagelistener on each new instance, intercepting Socket.IO v4 frames containingchat:completionusage data. Walks the payload recursively (up to 4 levels deep) to findusageobjects with token counts. Dispatchesowui-canvas-contextCustomEvents with{ exactTokens, promptTokens, completionTokens, source: 'socket' }— zero coupling with the context observer. - Context observer:
MutationObserveron#messages-containerthat scans.chat-userand.chat-assistantelements for DOM-based token estimation (debounced every ~2s). Navigation-aware — re-attaches when the active chat changes. Sends zero-state when navigating away from chat. - Canvas FX engine: Dual-mode execution —
OffscreenCanvasin a Web Worker when supported, automatic main-thread fallback when not. Handles 10 message types (init, resize, mousemove, click, mousedown, mouseup, touchstart, touchmove, touchend, context); click/mousedown/mouseup listeners use the capture phase so they fire even when UI elements stop propagation. Mousemove and touchmove are rAF-coalesced for efficient cross-thread messaging. Includes iframe mouse-event bridge for the Launcher Tool. - Theme enforcement:
enforceTheme()injects/updates CSS<style>blocks,refresh()re-applies theme and re-initializes canvas. AMutationObserveron<html>attributes +popstate,storage, andprefers-color-schemelisteners ensure the theme survives SPA navigations.
- Theme state loading: Reads config from
-
Server-Side Persistence & FOUC Prevention: Themes are saved in
DATA_DIR/theme/:open_theme_designer.css— the generated CSS served at{designer_url}/theme.cssopen_theme_designer.json— the full theme state served at{designer_url}/state.jsonopen_theme_designer_sections.json— the structured CSS sections (vars/structural/gradient/custom) that consumers assemble selectively (auth-page stripping, flash-free inline subset)open_theme_designer_library.json— the preset library
Delivery is cached on file mtime plus the valves that affect post-processing, so the steady-state cost of serving either composed asset is a
stat().FOUC prevention:
/static/custom.csscarries a safe subset of the theme (palette variables + custom CSS, with structural and gradient rules deferred so the page doesn't flash through to the background before the canvas starts). Open WebUI already loads that file as a render-blocking stylesheet, so the subset applies before first paint. The bootloader then fetches the full CSS and applies the deferred rules. Canvas FX scripts are deliberately not inlined — they are the bulk of the state, and the composed asset is rebuilt and hashed on every request, so they arrive with the/state.jsonfetch a moment later. As a Watchtower recovery fallback the bootloader writes theme data through tolocalStorage, so a client can re-apply the last known theme before the server files are refetched. -
SSE Push Architecture: When the designer saves a theme, the POST handler writes CSS + state to disk and calls
_broadcast_update(), which pushes a lightweight version token (with ETags) to all connected SSE clients (_sse_clients); each client then refetches/theme.cssand/state.json, with ETag revalidation so unchanged files cost a cheap 304. SSE clients are stored onapp.stateto survive function hot-reloads. Thetheme-disableevent type is broadcast when the admin toggles the function OFF. In multi-worker deployments,_redis_publish()broadcasts to thetheme_pro_sseRedis pub/sub channel, ensuring all workers relay updates to their local SSE clients.Valve convergence (multi-worker): Open WebUI reloads a function's valves only on the worker that served the change, so peers hold stale valves until their own next event. The changing worker detects that any valve differs from its last snapshot and publishes an internal
valvesynccontrol message on the same Redis channel. Peers intercept it before it reaches a browser, re-read their valves viaFunctions.get_function_valves_by_id, re-prime their delivery caches, and nudge their local clients — re-registering routes ifdesigner_urlmoved. The control message is framed as an SSE comment, so a peer on an older build that forwards raw channel traffic delivers a harmless keep-alive. The whole path is fail-safe: a peer that cannot read or validate the stored valves keeps what it has and converges on its own next event, exactly as before this mechanism existed. -
Structural Transparency (CSS): The generated CSS makes UI containers transparent so Canvas FX and gradient backgrounds show through. Transparency is scoped to
.app,#theme-designer-container(the designer page root), and#auth-pageusing:where()selectors for zero specificity. Portaled UI (dropdown menus, modals, submenus) lives outside.appondocument.body— never made transparent — so no override rules are needed. -
Selective Auth Page Stripping: The bootloader assembles auth-page CSS from the structured sections delivered inside
state.json(under the_cssSectionskey), honoring each feature’s independent "Show on Auth Pages" toggle (colors, custom CSS, canvas, gradient). For themes saved by older versions without sections, it falls back to slicing the flat CSS by/*[OWUI_*]*/marker comments. -
Function Lifecycle Integration: When the admin toggles the function OFF, Open WebUI dispatches
function.disable_startedsynchronously, before the toggle is committed. Theme Designer Pro sets a flag both fragment producers read at compose time, so the very next request serves acustom.csswithout its block and aloader.jswith__THEME_ACTIVE__=false— keeping SSE alive for the disable broadcast — and broadcaststheme-disableto all connected clients. When toggled back ON,function.enable_startedrepublishes and broadcasts the saved theme to all clients immediately. These pre-toggle lifecycle events exist in Open WebUI v0.11.0 and newer; on older builds the toggle simply takes effect without live cleanup/re-injection. -
Hot Reload Behavior: When the event function is re-saved in the admin panel, the next
event()call republishes both fragments, leaving the registry holding the new instance's producers. Route registration inserts ASGI routes before the SPA catch-all to ensure they take priority.
🧱 Shared Static Assets (1.7.0)
Open WebUI ships two intentionally-empty files that it loads on every page as admin extension points:
| Path | How it loads | Why it matters |
|---|---|---|
/static/loader.js |
<script defer> |
The only hook that runs before the SvelteKit bundle hydrates |
/static/custom.css |
<link rel="stylesheet"> |
Render-blocking, so it applies before first paint |
Neither can have a single owner — any plugin wanting to reach the page pre-paint needs one of them. Theme Designer Pro therefore uses a shared registry, designed with @Classic298, that every participating plugin can publish into:
- Each plugin registers a fragment on
app.state; a route composes all registered fragments into the response per request. - Load order is irrelevant. A plugin that loads later needs no cooperation from one that loaded earlier, and a re-exec'd plugin replaces its own entry.
- Any content you have hand-written into those two files is preserved and served first; only the block between a plugin's own markers is ever replaced.
- Composition order is
(order, key). Theme Designer Pro registers atorder=100so its custom CSS keeps the last word in the cascade, matching the documented CSS output order. - A fragment whose producer raises is skipped and logged — one broken plugin cannot blank a page-wide asset.
- Producers run synchronously on the request path, so everything Theme Designer Pro publishes is memoised; the steady-state cost is a
stat().
The registry block is kept byte-identical across participating plugins, and carries an implementation version so a newer copy evicts an older one and the fleet converges on one implementation rather than whichever plugin booted first.
What this replaced. Up to 1.6.2 this function read-modify-wrote the frontend's index.html under a cross-process fcntl lock to inject its bootloader and a <style> block. That is gone entirely, along with the class of bugs that came with writing to a file the application also owns (duplicate block accumulation, stale embedded CSS that no save could refresh, and the need for write access to the frontend build). It also means themes now track the latest save on every page load rather than only after the next event().
Scope. The two assets reach the SPA — the chat UI and the auth pages. The designer page is its own document and does not load them; it manages its own styling directly.
🔌 API Routes
All routes are registered under the configurable designer_url base (default: /api/v1/theme-designer).
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | {designer_url} |
Admin | Serves the Theme Designer Pro HTML page |
| POST | {designer_url} |
Admin | Saves CSS + state + library, broadcasts SSE update |
| GET | {designer_url}/theme.css |
Public | Serves generated theme CSS (204 if inactive or missing) |
| GET | {designer_url}/state.json |
Public | Serves saved theme state JSON (204 if inactive or missing) |
| GET | {designer_url}/events |
Public | SSE endpoint for real-time push updates |
| GET | {designer_url}/library.json |
Admin | Serves the preset library (themes, canvas, CSS, gradients) |
Graceful degradation: Missing CSS or state files return HTTP 204 (no content), not 500 errors. Corrupted JSON is served as-is — the client handles parse errors.
🧩 Canvas FX API Contract
All Canvas FX scripts must follow this Web Worker contract:
// Receive messages from the host
self.onmessage = (e) => {
switch (e.data.type) {
case 'init': // { canvas: OffscreenCanvas, width, height, env }
case 'resize': // { width, height }
case 'mousemove': // { x, y }
case 'click': // { x, y }
case 'mousedown': // { x, y }
case 'mouseup': // { x, y }
case 'touchstart': // { touches: [{x, y}, ...] }
case 'touchmove': // { touches: [{x, y}, ...] }
case 'touchend': // { touches: [{x, y}, ...] }
case 'context': // { messages, chars, estimatedTokens } or { exactTokens, promptTokens, completionTokens, source }
}
};
// Send heartbeat to prevent worker termination
setInterval(() => { self.postMessage({ type: 'heartbeat' }); }, 1000);
// Use requestAnimationFrame for the render loop
// NO DOM access (no document, window, alert, localStorage)
Note: The
initmessage includes anenvobject with{ authToken, baseUrl, locale, timezone }.authTokenis the token of whichever user is viewing the page, not the admin's, and is an empty string unless theenable_canvas_api_accessvalve is enabled. A script that receives it can call the Open WebUI API with that user's permissions, so treat any script you did not write as untrusted before turning the valve on.
Dual Execution Modes
| Mode | Condition | Canvas Type |
|---|---|---|
| Worker | Browser supports OffscreenCanvas + script doesn't reference document |
OffscreenCanvas transferred via postMessage |
| Fallback | No OffscreenCanvas support, or script throws in Worker |
Standard <canvas> DOM element; synthetic self object provided |
The fallback is automatic — Worker errors are caught, the Worker is terminated, and the script is re-run on the main thread.
❓ Troubleshooting & FAQ
-
My theme disappears after a container recreate.
- Reason: Fragments live in process memory, so a fresh container serves the stock (empty)
loader.jsandcustom.cssuntil the function publishes again. Open WebUI dispatchessystem.startup.completedduring boot, which republishes automatically; if you catch a page load inside that window, reload it.
- Reason: Fragments live in process memory, so a fresh container serves the stock (empty)
-
Valve changes aren't taking effect.
- Reason: Saving valves in the admin panel doesn't trigger
event()directly. Send any chat message or wait for the next system event — the function detects the valve change on the nextevent()invocation.
- Reason: Saving valves in the admin panel doesn't trigger
-
The designer page returns a 404.
- Fix: The event function registers its routes dynamically. If the function hasn't processed an event yet since the last restart, the route may not exist. Send a chat message to trigger
event(), which registers routes on first invocation. - Also check: Ensure the
designer_urlvalve matches the URL you're navigating to.
- Fix: The event function registers its routes dynamically. If the function hasn't processed an event yet since the last restart, the route may not exist. Send a chat message to trigger
-
My theme doesn't apply to other users.
- Fix: Most commonly caused by reverse proxy buffering — see in-app Docs → Section 17. Also ensure the admin has synced the theme via the designer (not Draft mode). The bootloader serves the theme to all users on page load from
{designer_url}/theme.css. If the theme files are missing fromDATA_DIR/theme/, the bootloader has nothing to serve. Verify the endpoint works by navigating directly to{designer_url}/theme.cssin your browser — it should return CSS content.
- Fix: Most commonly caused by reverse proxy buffering — see in-app Docs → Section 17. Also ensure the admin has synced the theme via the designer (not Draft mode). The bootloader serves the theme to all users on page load from
-
Canvas FX animations are lagging.
- Fix: Heavy animations can drain resources. Ensure your browser supports
OffscreenCanvas(indicated by the green "Background Worker" badge in the UI). If it says "Main Thread (Fallback)", keep animations simple.
- Fix: Heavy animations can drain resources. Ensure your browser supports
-
Leftover blocks in
index.htmlafter upgrading from 1.6.2 or earlier.- Reason: Older versions wrote directly into
index.html, and that file survives an upgrade. Version 1.7.0 removes those blocks once, automatically, on its first event, and logs that it did. Nothing writes toindex.htmlany more.
- Reason: Older versions wrote directly into
-
A theme I deleted keeps being served.
- Reason: Deleting the function without disabling it first leaves its fragment in memory — Open WebUI dispatches
function.deletedafter the row is gone, so the plugin never receives it. Disable, then delete. A container restart also clears it.
- Reason: Deleting the function without disabling it first leaves its fragment in memory — Open WebUI dispatches
-
Theme works but not on the auth/login page.
- Check: Ensure the "Show on Auth Pages" toggles are enabled for each feature you want on auth pages (Colors, CSS, Canvas, Gradient). Also verify the
enable_auth_page_themingvalve istrue.
- Check: Ensure the "Show on Auth Pages" toggles are enabled for each feature you want on auth pages (Colors, CSS, Canvas, Gradient). Also verify the
-
Theme reverts after disabling the function.
- Reason: Toggling the function OFF triggers the
function.disable_startedlifecycle event, which broadcasts atheme-disableSSE event to strip the theme from all clients and withdraws the CSS fragment fromcustom.css. When re-enabled, thefunction.enable_startedevent republishes everything automatically. On Open WebUI older than v0.11.0 these lifecycle events don't exist, so the theme instead persists after disabling — follow the Uninstallation steps below for complete removal.
- Reason: Toggling the function OFF triggers the
-
SSE connection keeps reconnecting.
- Reason: SSE connections are long-lived. Some reverse proxies (Nginx, Cloudflare) terminate idle connections. Configure your proxy to allow long-lived connections on the
/eventsendpoint, or increase proxy timeout settings.
- Reason: SSE connections are long-lived. Some reverse proxies (Nginx, Cloudflare) terminate idle connections. Configure your proxy to allow long-lived connections on the
-
Multi-worker deployment: themes only update on some users.
- Fix: Set
REDIS_URLin your environment (which Open WebUI already uses for WebSocket relay). Theme Designer Pro automatically uses Redis pub/sub to broadcast SSE events across all workers. No additional configuration needed.
- Fix: Set
🗑️ Uninstallation & Complete Removal
Disabling the function withdraws its theme immediately, but your saved themes and preset library stay on the server. Follow these steps for complete removal:
Step 1: Factory Reset (Purge All Data)
The easiest way to wipe all saved data is to open Theme Designer Pro, click the 📖 Docs button in the header, and click the red Factory Reset (Wipe All Data) button under the Danger Zone section (Section 21). This permanently deletes all themes, snapshots, and configuration.
Step 2: Remove Server Files
Delete the theme data files from your container:
docker exec <container_name> rm -f /app/backend/data/theme/open_theme_designer.*
Step 3: Disable the Function (before deleting it)
Toggle the function OFF in the Admin Panel first. That withdraws its fragment immediately. Deleting it while still enabled leaves the fragment serving until the process restarts, because Open WebUI dispatches function.deleted after the row is gone and the plugin never receives its own deletion.
Step 4: Remove the Function
Delete the function from the Admin Panel under Functions. Nothing is left on disk in the frontend build — 1.7.0 never writes there.
Upgrading from 1.6.2 or earlier? Those versions did patch
index.html. 1.7.0 cleans that up automatically on first run; to verify by hand, check that<!-- OWUI Theme Pro Bootloader -->is absent from/app/build/index.html.
📝 What's New in 1.8.5
Theme rules no longer style the page's root element in dark, OLED and Her modes. Open WebUI marks each mode on the page's root element twice, with a class and with a data-theme attribute, and the theme's mode selectors list both. The rules that style elements inside the page put that list in front of the element they target, which scoped only the data-theme half. The class half matched the root element itself, so in those modes, the root element picked up rules meant for the sidebar, the chat area and the chat input. With a gradient theme, the root element carried the sidebar's tint and the chat input's fade. Each rule now reaches only the elements it names. The rules keep the same CSS priority, so a theme's own custom CSS wins exactly where it did before. Custom CSS written in Raw mode with :root in front of a selector gets the same fix. A theme saved before this update picks up the change the next time you open the designer.
The heading of section 17c in the built-in documentation fits on one line again. Its words had spread across the whole row around the two file names.
This release adds no valves and changes no theme settings.
📝 What's New in 1.8.4
Code block headers stay solid over a Canvas FX or gradient background. To let the background show through the chat's top bar, the theme clears the background of every sticky element in Open WebUI. The header above a code block, the bar with the language label and the Copy button, is sticky too. Once you scrolled partway into a long code block, the label and buttons sat on top of the code lines passing underneath. That header now keeps Open WebUI's own background, and the chat's top bar stays see-through. A theme saved before this update gets the change the next time you open the designer, which saves the theme again as it loads.
The designer's switches and sliders read correctly under any theme. Most community themes style every text field with a background marked !important. The designer previews your theme on its own page, so that rule also reached its switches and sliders. A switch that was on drew with a dark track and looked off, and the slider tracks almost disappeared. The designer's own controls now keep their colors.
This release adds no valves and changes no theme settings.
📝 What's New in 1.8.3
Opening the designer no longer overwrites the live theme. The designer kept its working copy of the theme in your browser and, in Live mode, saved that copy to the server as soon as the page opened. The main app refreshes that copy every time it loads, but the designer page never did. So a browser that hadn't loaded the main app since the last save pushed its own older copy over the theme every user sees. Opening the designer URL directly in a new browser reset the theme to the defaults. A second admin, or one admin on a second computer, put back whichever theme that browser saw last.
The designer now starts from the theme the server is serving, the same way the main app does. When no theme is saved, it starts from the defaults. Draft mode works as before, and your edits stay in the tab until you publish them.
This release adds no valves and changes no theme settings.
📝 What's New in 1.8.2
Theme changes now reach every container. If you run Open WebUI on more than one container with Redis, a theme save, a function toggle or a valve change made through one container used to show up on that container alone. Open tabs on the other containers were never told, and pages loaded from them kept the old state until that container restarted. All of these now reach every container within a few seconds. A single-container install behaves exactly as before.
Three things were in the way:
- Every container ignored the others' live updates. Each update sent over Redis carried the sender's process ID, so the sender could skip its own message. Inside a container the server is usually the first process and gets the same process ID in every container, so each one took the other containers' updates for its own and dropped them. The tag now includes the container's hostname.
- Turning the function off or saving new code stayed on one container. Theme Designer Pro now uses the live reload add-on from Classic298's Shared Assets Protocol. Turning the function off or on, or saving new code, reaches every container, and each container loads the new code from the database.
- The 1.7.9 valve sync never worked. It read the valves with a database call that is asynchronous in every Open WebUI release this function supports, so the other containers got back an unfinished result and kept their old valves. The read now waits for the database. A designer URL change also moves the designer page on every container now, and the old URL stops serving it.
After you install 1.8.2, a container still running 1.8.1 can't hear the new code. It picks up 1.8.2 the next time it handles any event, such as a new chat, or when it restarts. From then on, every update reaches it without help. A container that starts while the function is off also needs one event before it hears the function being turned back on.
This release adds no valves and changes no theme settings.
📝 What's New in 1.8.1
List rows and menu items no longer render as dark blocks over a Canvas FX or gradient background. Knowledge collections in the chat input's More menu, the Download and Move submenus inside a chat's ellipsis menu, and the chat rows in the search modal all sat as opaque slabs on top of the animated background, while the panel around them stayed correctly translucent.
The structural transparency rules matched any element whose class attribute contained bg-gray- anywhere. Tailwind writes state variants into that attribute as literal text, so hover:bg-gray-50/40 and dark:[&>button:hover]:bg-gray-800/60 matched exactly as readily as a real background utility. Elements that have no background at all until you hover them were being handed one permanently, backdrop blur and all. On Open WebUI's current dev branch, 452 elements carry a gray background only inside a hover variant.
Both transparency layers now match a background utility at a token boundary instead of anywhere in the string:
[class^="bg-gray-"], [class*=" bg-gray-"],
[class^="dark:bg-gray-"], [class*=" dark:bg-gray-"]
A base utility either starts the attribute or follows a space, while a variant is always preceded by its own prefix, so the two separate exactly. No list of exceptions is required, and nothing that genuinely carries a background loses its glass treatment. Panels, modals and dropdown containers keep precisely what they had in 1.8.0.
Hover highlights return inside the app. The same over-match applied to the .app rule, which sets background-color: transparent !important. Since !important beats a Tailwind hover rule whatever its specificity, any row whose highlight lives in a hover variant had that highlight suppressed. Those rows now behave the way Open WebUI intends.
This release adds no valves and changes no theme settings.
📝 What's New in 1.8.0
Accessibility contrast checking. The palette editor now shows a live WCAG contrast report directly under the tonal ramp. Because a Theme Designer Pro theme is applied to every user on the instance, a palette that renders text unreadable is an instance-wide accessibility problem — and until now nothing surfaced it.
The report scores the four text-on-background pairs Open WebUI renders for the active mode: main and muted text on the page background, main text on elevated surfaces, and main text on the sidebar. Each row shows a foreground-on-background swatch, the contrast ratio, the palette steps being compared (50 on 900, so you can check the comparison rather than take the label on trust), and a badge — AAA (≥7:1), AA (≥4.5:1), AA large (≥3:1, valid for large or bold text only), or Fail. A summary reports how many pairs clear AA. It recomputes the instant you move a slider, edit an override, or switch modes.
It measures the colors that actually ship, which is not simply the palette:
- Manual Variable Overrides are applied first. They are injected after the palette with
!importantand win outright, so a rating that ignored them would describe a color the override replaced. A note tells you how many measured values came from overrides. - A disabled palette reports the mode's defaults, because that is what the theme emits when Enable Palette is off — not your slider values.
- Colors that only resolve in the live page —
var(--…), for instance — are reported as Unknown rather than scored. They resolve to black on the off-screen canvas used for measurement, which would otherwise produce a confident, false "Fail". - Contrast is measured against the solid background. With a Canvas FX or gradient background active the visible backdrop is an animation WCAG cannot score, and the solid color is the fallback every user still sees.
- Washed-out palettes are flagged, since the built-in protection shifts text color at runtime and users may see better contrast than the palette alone scores.
The ratios use gamma-correct WCAG 2.x relative luminance, verified against the standard's reference boundaries: black on white is 21:1, #767676 on white is 4.54:1 (the classic AA-normal edge), #595959 on white is 7.0:1.
Also fixed in this release, both pre-existing:
- The built-in contrast protection now sees Manual Variable Overrides. It judged whether a palette was washed out by reading the palette alone, but overrides land in the same variables the designer page is themed from. An override such as
--color-gray-950: #fffffflightened the background while the check still read the palette's dark value, so protection stayed off and the designer could draw near-white text on a near-white background. - Three-digit hex overrides work properly.
#abcwas never expanded to#aabbcc. Because the palette's color-picker inputs require six digits, a short-hex override made the picker display black instead of your color, and its "Aa" legibility badge picked the wrong text color. Colors with alpha also resolve consistently now; the scratch canvas used for resolution was never cleared, so a translucent value could blend into whatever the previous lookup left behind.
Resolved colors are cached, so the report reads values the tonal ramp already resolved rather than forcing its own round-trips to the GPU — dragging a color slider does less of that work per frame than it did in 1.7.9.
This release adds no valves and does not change a single byte of the generated theme CSS.
📝 What's New in 1.7.9
Valve changes now converge across a multi-container deployment. This only matters if you run Open WebUI as more than one container behind Redis; a single-container install is unaffected and takes no new code paths.
The problem: when you change a valve (say, overlay transparency, or the Canvas API access toggle), Open WebUI reloads the function on the one container that served your request. Every other container keeps its cached copy with the old value until something else happens to dispatch an event to it. Because nearly every valve changes what the composed loader.js serves, those other containers could keep serving the previous setting to their users for that window. It self-healed, but the window was real.
Now the container that saw the change signals its peers over the Redis channel the function already uses for live theme updates, and each peer re-reads its valves from the database and re-primes. The signal is a distinct control message that never reaches a browser, and it is framed as an SSE comment so that during a rolling upgrade a peer still running 1.7.8 treats it as a harmless keep-alive rather than a malformed event. If a peer cannot read the database, or reads something that no longer validates, it simply keeps its current valves — exactly the pre-1.7.9 behaviour, where it converges on its own next event. A designer_url change re-registers routes on the peers too, so even moving the designer path propagates.
There are no valve, UI, or theme-format changes in this release, and the designer page itself is byte-for-byte identical to 1.7.8.
📝 What's New in 1.7.8
A review pass over the 1.7.4 hardening found that some of it was wrong, and found more of the same class of problem elsewhere.
Fixed a regression introduced in 1.7.4. The sanitizer's numeric guard used Number(), and Number(null) is 0 — a finite number, so the guard accepted it. Every numeric theme field left unset therefore became 0 instead of falling back to its default. In practice: gradient angles snapped to 0deg, intensity collapsed to grey, and animated gradients froze at 0s. Any theme relying on a default for one of those fields rendered wrong from 1.7.4 onward. Unset now correctly means unset.
Closed the remaining injection paths. 1.7.4 sanitized the generated stylesheet; several surfaces in the admin's own browser were still rendering remote values raw. Theme names and versions went into inline onclick handlers in the update list, where a crafted name executed as JavaScript — those values now travel through escaped data- attributes read by a delegated handler, so they are never in executable position at all. The tonal-ramp preview, the gradient preset swatches and stop rows, and the mesh dots all sanitize now.
The theme library's rich tooltip was the worst of them: its markup was escaped into an attribute and then read back out with getAttribute and assigned to innerHTML. The HTML parser decodes entities when it builds an attribute value, so the escaping was undone before the markup reached the sink and a theme named <img src=x onerror=...> executed on hover. Rich tooltips are no longer round-tripped through the DOM at all.
Updates that install code now ask, on every path. 1.7.5 added a warning for updates that add or change a Canvas FX script. It compared script bodies, but catalog updates do not carry bodies — so it always concluded "no script change" and stayed silent on exactly the path where a hostile script would arrive. Catalog updates now report the risk as unknown rather than none.
More importantly, the confirmation itself now lives in the one function every update path funnels through. It used to sit on the catalog path alone, which meant the paths that had already downloaded the payload — "Update All" and the per-row Update button, where an added script is a known fact rather than a possibility — installed it with no prompt at all. An update that flips an existing script from disabled to enabled warns too, as does one that changes instance-wide custom CSS.
Allowed Import Domains no longer has a bypass. The check existed twice, and the older copy failed open on a URL it could not parse and matched hosts case-sensitively, so EVIL.COM passed an allowlist written in lowercase. There is now one check, and one URL rewriter feeding it: they used to be separate, and the manual import path had a gist.github.com rewrite the check did not know about, so a gist was approved against one host and fetched from another. Every remote fetch now re-validates after redirects, so an allowed host cannot hand off to a blocked one, and the community catalog, manifest and bundle go through the same gate — a restrictive allowlist stops the automatic update traffic too, not just the manual button. Every remote response is size-capped, which it was not on any of the automated paths.
Gradient presets are validated on import. They are a separate import format with their own file type, and nothing ever validated them — so a preset carrying a crafted colour reached the designer's own markup unchecked. They now go through the same normalization as everything else, at the one function through which every preset becomes live theme data. Themes restored from the server library and from older local storage are validated at the door as well.
Also fixed: conic gradients fell through to a linear gradient in one CSS builder and still previewed as linear in two others; the animation-speed clamp enforced its floor but not its ceiling; "Update All" reported success for updates that failed, and now reports what actually happened with a Retry Failed action that retries only the failures; a non-string value in remote theme JSON silently killed the update dialog; a malformed colour could abort CSS generation for a whole theme.
📝 What's New in 1.7.7
Clearer warning on the Canvas API Access valve. No behaviour change — the valve still defaults to off and works exactly as before. The old description said it passes "the user's auth token", which reads as though it means the admin's. It does not: Canvas FX scripts run on every user's page, so the token handed to a script is that viewer's, and a script holding it can call the Open WebUI API with their permissions.
The description now says so plainly, and adds the two things that make the decision ongoing rather than one-off: scripts referencing document run on the main thread where a Worker's isolation does not apply, and an installed theme can replace its script later through its update URL. The Canvas FX protocol documentation and the valve reference table carry the same correction.
📝 What's New in 1.7.6
Two authorization fixes.
Revoked tokens are now rejected. The admin check verified a token's signature and expiry but never asked whether it had been revoked. Open WebUI revokes tokens on sign-out and on OIDC back-channel logout, and its own get_current_user checks this between decoding the token and loading the user. Theme Designer Pro skipped that step, so a token belonging to a session an admin had explicitly signed out of kept working against the designer and its save endpoint until it expired on its own. Revocation exists precisely for the case where a session is believed compromised, so ignoring it was the wrong default. The check now runs, fails closed on error, and is skipped only on Open WebUI builds that predate the feature.
Allowed Import Domains now covers automated fetches. The valve only ever wrapped the manual "Load from URL" button. Community theme installs and theme update checks fetch from URLs supplied by the catalog or by the installed theme itself, and those bypassed the allowlist entirely — the paths where the URL is not chosen by the admin, and therefore the ones that most needed gating. All remote theme fetches now share one host check. Blocked hosts are never contacted, so a restrictive allowlist also stops update checks beaconing to third-party hosts. The check runs after GitHub blob-to-raw rewriting, so the host validated is the host actually contacted. An empty valve still means unrestricted, as documented.
📝 What's New in 1.7.5
Theme updates that add or change a Canvas FX script now warn you. A Canvas FX script is JavaScript that runs in the browser of every user on the instance, not just the admin's; scripts that reference document run on the main thread rather than in a Worker; and with the Canvas API Access valve enabled they receive the viewer's auth token.
Importing a theme has always warned about this. Updating one did not. A theme that was benign when installed could later serve a hostile script simply by changing what its updateUrl returns, and that arrived as one unremarkable row inside a collapsed diff. Both the single-update modal and the "Update All" batch results now show an explicit security warning when an update introduces or replaces a script. Unchanged scripts, whitespace-only differences, and updates that remove a script do not warn, so the warning stays meaningful.
Hardened the cross-frame mouse bridge. The Canvas FX iframe bridge accepted postMessage coordinates from any frame without validating them. Open WebUI renders untrusted content in sandboxed iframes whose origin is "null", so an origin allowlist cannot gate this — the coordinates are the entire payload, so they are now type-checked instead. Previously a non-numeric value could be forwarded into the Worker and throw inside the animation-frame loop, ending mouse tracking for the rest of the session.
📝 What's New in 1.7.4
Security: CSS injection from imported themes. Theme data was interpolated into CSS without sanitizing. That was safe while every theme was hand-authored locally, but community themes, "Install All", and per-theme update checks all fetch JSON from arbitrary updateUrls, and the importer merged that JSON with a plain spread — no type or content validation. The preset repo's CI schema guards contributions to the repo; it never runs on what an installed theme points its update URL at.
Two scopes were affected:
- Instance-wide (serious). Colour-override values and several gradient fields flowed verbatim into the generated theme CSS — the stylesheet saved server-side and served to every user at
/theme.cssand via/static/custom.css. A crafted override value escaped its rule block and injected arbitrary CSS for everyone, enabling selector-based data exfiltration, UI spoofing, and content hiding. - Admin's browser. The community themes browser and the theme update diff rendered remote values into
style=""attributes, allowing attribute breakout in the admin's own session.
Fixed at both ends: values are validated on import, and sanitized again at every point they become CSS. Legitimate colour syntax is unaffected, including #hex, named colours, rgb()/rgba(), oklch(), var(--x), color-mix(), and modern slash-alpha forms like rgb(0 0 0 / 50%). customCSS, canvasScript and manualOverrides are deliberately left free-form — arbitrary CSS/JS there is the intended feature.
Verified against the full preset corpus: 33 themes, 132 modes, generated CSS byte-identical before and after.
Also fixed: compareGradientProps treated null and false as different values for boolean flags, so a theme loaded without normalization compared against a normalized one showed a "Diff" badge for a difference that did not exist.
📝 What's New in 1.7.3
Two fixes from a full audit pass:
- Global Reset no longer jams saving. A reset broadcasts the same
theme-disableevent as a function toggle, and since 1.7.1 the designer responded by holding every subsequent save — waiting for a re-enable that would never come, because the function was running the whole time. The broadcast now carries areason, and the designer only holds saves on a real disable. Older payloads are treated as a real disable, so mixed versions fail safe. - The preset library gets the same disabled-state protection as themes. Importing presets or saving snapshots while the function was toggled off fired into a
503with a misleading "sync failed" toast and the data was lost. Library syncs are now held and replayed on re-enable, including the mid-flight case.
📝 What's New in 1.7.2
Disabling the function now clears the theme on clients that were not watching. Regression introduced in 1.7.0: the flash-free palette subset moved from an inline <style> block into the shared /static/custom.css. The disable handler strips its own elements by id, but that stylesheet belongs to Open WebUI and carries other plugins' fragments and any CSS you wrote there yourself, so it cannot simply be removed — and a <link> is only re-fetched on a full page load. The result was a partially themed UI (palette colours, no canvas or gradient) surviving a disable indefinitely.
Most visible on a phone PWA: iOS kills the SSE connection when the app is backgrounded, so the theme-disable broadcast never arrives and the client only learns of it on resume.
The bootloader now re-points that stylesheet at a cache-busting URL when the theme is switched off, re-fetching the freshly composed file without this plugin's block. Other plugins' fragments and your own hand-written CSS are preserved. This runs both on the theme-disable broadcast and on any fetch that comes back empty, which is the path a resuming PWA takes.
📝 What's New in 1.7.1
Theme changes made while the function is disabled are no longer lost. The save endpoint answers 503 whenever the function is toggled off, which is intended — a disabled function should not persist themes. But the designer went on accepting edits, fired each one into a rejection, and reported it as a generic "server sync failed". Toggling the function back on then made every client fetch the theme from before it was switched off, while the designer still displayed the newer one it had never managed to save.
The designer already knew the function was off (its status badge has its own SSE connection), it just wasn't acting on it. Now:
- Saves are held rather than fired into a
503, with a message that says the function is disabled and the change is kept locally. - Toggling the function back on republishes the theme you selected while it was off, and says so.
- A
503arriving mid-flight (toggled off while a save was already in flight) latches the same state instead of reporting a network error.
📝 What's New in 1.7.0
Themes no longer patch index.html. The bootloader and theme CSS are published into Open WebUI's shared /static/loader.js and /static/custom.css and composed per request. See Shared Static Assets. Upgrading is automatic: leftover blocks from 1.6.2 and earlier are removed once, on the first event.
Consequences worth knowing:
- The frontend build directory no longer needs to be writable.
- Themes reflect the latest save on every page load, instead of waiting for the next
event(). - The whole class of duplicate-block and stale-embedded-CSS bugs is gone, because nothing is written.
- Canvas FX scripts are no longer inlined into the page; they arrive with the
/state.jsonfetch, so a background animation starts a fraction of a second later than before. Colors, layout and gradients are unaffected and still apply before first paint.
Save-path fixes (all pre-existing, most visible when the designer is open beside the main app):
- Saving a theme could persist the previous theme's state. The designer re-read its state from
localStoragewhen its debounced POST fired, and any other tab's write-through could land in that window — so the POST paired the new CSS with the old state. The state is now captured at call time. - The client applied
/theme.cssand/state.jsonfrom two independent fetches, so the page could render one theme's colors against another's canvas until the slower response arrived. Both are now applied atomically, and a failed half aborts the pair instead of being read as "no theme". - Cross-tab
storageevents repainted on each key separately. Because the designer writes its two keys a network round trip apart, that published a half-updated pair. Storage events now coalesce into a single re-read of a coherent pair from the server, and no longer repaint the designer page out from under the admin.
⚖️ Compliance & Legal Disclaimer
Theme Designer Pro is a tool provided for educational and customization purposes. By using this tool, you acknowledge and agree to the following:
- Compliance Responsibility: As of Open WebUI v0.6.6+, the software license strictly prohibits altering, removing, obscuring, or replacing any "Open WebUI" branding (including the name, logo, or distinguishing visual identifiers) in deployments with more than 50 active users in a 30-day period without an Enterprise License.
- Administrative Burden: The responsibility to ensure compliance rests entirely with the server administrator. While modifying color palettes is permitted, you must ensure that the Style Overrides tab is not used to hide, obscure, or alter the Open WebUI logo and branding in violation of the license.
- Liability Waiver: The author of Theme Designer Pro (@g30) shall not be held liable for any material breach of license, legal action, or service termination resulting from use or misuse of this tool.
- Safe Harbor: If your deployment is for personal use, internal team use (with permission), or for an organization of 50 or fewer active users, you are generally exempt from strict branding restrictions.
This tool is provided "as is" without warranty of any kind. By using Theme Designer Pro, you acknowledge that serving instance-wide CSS and JavaScript may have implications. Use only on trusted instances.
For more information, see the official Open WebUI License Guide.
⚠️ Canvas FX Performance Disclaimer
Canvas FX allows you to inject custom JavaScript animations directly into the background of Open WebUI. Animations execute on a dedicated Background Web Worker (OffscreenCanvas) by default, ensuring your chat interface remains smooth without blocking the main browser thread.
(Note: If your browser doesn't support OffscreenCanvas, the engine seamlessly falls back to main-thread execution).
Even with Web Workers, highly intensive animations (massive particle counts, heavy mathematical calculations) can consume significant CPU/GPU resources and drain battery life. Use this feature responsibly, test your scripts, and keep animations lightweight!
💡 Maintenance & Stability (PSA)
Open WebUI is a fast-moving project. Because this event function relies on the shared static assets and DOM observation to persist themes, future UI updates to Open WebUI may require adjustments. Use the export button to back up your favorite themes regularly!
graph TD
%% Styling definitions
classDef backend fill:#2b3a42,stroke:#3b82f6,stroke-width:2px,color:#fff
classDef frontend fill:#1e1e1e,stroke:#10b981,stroke-width:2px,color:#fff
classDef bootloader fill:#3a2b42,stroke:#8b5cf6,stroke-width:2px,color:#fff
classDef storage fill:#422b2b,stroke:#ef4444,stroke-width:2px,color:#fff
classDef endpoint fill:#1d4ed8,stroke:#93c5fd,stroke-width:2px,color:#fff
classDef helper fill:#2b4242,stroke:#14b8a6,stroke-width:2px,color:#fff
classDef sse fill:#42422b,stroke:#eab308,stroke-width:2px,color:#fff
classDef redis fill:#422b3a,stroke:#ec4899,stroke-width:2px,color:#fff
%% --- PYTHON BACKEND ---
subgraph Backend ["Python Backend: Event Function"]
EventFn(["async event()"]):::endpoint --> CheckLifecycle{"Lifecycle event?"}:::backend
CheckLifecycle -->|"function.disable_started"| DisableCleanup["Strip theme + broadcast disable"]:::backend
CheckLifecycle -->|"function.enable_started"| EnableReinject["Reset _injected flag"]:::backend
CheckLifecycle -->|"Other"| CheckInjected{"_injected?"}:::backend
CheckInjected -->|"No"| InjectPipeline["Full Injection Pipeline"]:::backend
CheckInjected -->|"Yes"| CheckValves{"Valve changes?"}:::backend
CheckValves -->|"canvas_fx changed"| ToggleCanvas["Re-inject stripped state"]:::backend
CheckValves -->|"sidebar/overlay changed"| ToggleTransparency["Re-inject CSS + broadcast"]:::backend
CheckValves -->|"designer_url changed"| ReRegister["Re-register routes"]:::backend
InjectPipeline --> RegisterRoute["_register_route()"]:::helper
RegisterRoute --> FindSPA{"Find SPA catch-all"}:::backend
FindSPA --> InsertRoutes["Insert 6 ASGI routes"]:::backend
InjectPipeline --> Publish["_publish_fragments()"]:::helper
Publish --> RegLoader["register loader.js fragment"]:::helper
Publish --> RegCss["register custom.css fragment"]:::helper
RegLoader --> Compose["Composed per request"]:::backend
RegCss --> Compose
InsertRoutes --> RoutePage(["GET /theme-designer"]):::endpoint
InsertRoutes --> RouteSave(["POST /theme-designer"]):::endpoint
InsertRoutes --> RouteCSS(["GET /theme.css"]):::endpoint
InsertRoutes --> RouteState(["GET /state.json"]):::endpoint
InsertRoutes --> RouteSSE(["GET /events"]):::endpoint
InsertRoutes --> RouteLib(["GET /library.json"]):::endpoint
RoutePage --> RequireAdmin["_require_admin()"]:::helper
RequireAdmin --> BuildHTML["_build_html()"]:::helper
BuildHTML --> ServeHTML(("HTMLResponse")):::frontend
RouteSave --> SaveCSS["_save_css()"]:::helper
RouteSave --> SaveState["_save_state()"]:::helper
RouteSave --> Broadcast["_broadcast_update()"]:::sse
end
%% --- SSE PUSH ---
subgraph SSELayer ["Real-Time Push: Server-Sent Events"]
Broadcast --> RedisPublish["_redis_publish()"]:::redis
RedisPublish -.->|"Multi-worker"| RedisChannel[("Redis: theme_pro_sse")]:::redis
RedisChannel -.-> OtherWorkers(("Other Workers")):::redis
Broadcast --> SSEClients[("Local SSE Clients")]:::sse
SSEClients --> Client1(("Browser 1")):::frontend
SSEClients --> Client2(("Browser 2")):::frontend
SSEClients --> ClientN(("Browser N")):::frontend
end
%% --- INJECTED BOOTLOADER ---
subgraph Bootloader ["Bootloader: composed into /static/loader.js"]
Compose -.->|"served"| BootInit["Bootloader IIFE"]:::bootloader
BootInit --> LoadState["Load state from server + localStorage"]:::bootloader
BootInit --> SSEConnect["Connect to /events SSE"]:::bootloader
BootInit --> SocketIntercept["Socket Interceptor — WebSocket token extraction"]:::bootloader
BootInit --> ContextObs["Context Observer — MutationObserver"]:::bootloader
SSEConnect -->|"theme-update"| Refresh["refresh()"]:::bootloader
SSEConnect -->|"theme-disable"| StripTheme["Strip all theme CSS"]:::bootloader
Refresh --> Enforce["enforceTheme()"]:::bootloader
Refresh --> CanvasInit["initCanvas()"]:::bootloader
ContextObs --> CanvasInit
SetupListeners["SPA Navigation Listeners"]:::bootloader
SetupListeners --> MutObs["MutationObserver: html attrs"]:::bootloader
SetupListeners --> PopState["popstate Listener"]:::bootloader
SetupListeners --> MediaQuery["prefers-color-scheme Listener"]:::bootloader
SetupListeners --> StorageEvent["storage + owui-theme-updated Listeners"]:::bootloader
MutObs --> Refresh
PopState --> Refresh
MediaQuery --> Refresh
StorageEvent --> Refresh
Enforce --> DOMUpdate(("Apply CSS to DOM")):::frontend
CanvasInit --> CanvasRender(("Worker / Fallback Canvas")):::frontend
end
%% --- SERVER STORAGE ---
subgraph ServerStorage ["Server-Side Storage: DATA_DIR/theme/"]
SaveCSS --> CSSFile[("open_theme_designer.css")]:::storage
SaveState --> StateFile[("open_theme_designer.json")]:::storage
RouteCSS --> CSSFile
RouteState --> StateFile
RouteLib --> LibFile[("open_theme_designer_library.json")]:::storage
end
%% --- DESIGNER UI ---
subgraph DesignerUI ["Theme Designer UI: Standalone Page"]
ServeHTML -.->|"Loads in browser"| UILoad["Initialize Designer App"]:::frontend
UILoad --> FetchState["Fetch /state.json + /theme.css"]:::frontend
FetchState --> Tabs{"6 UI Tabs"}:::frontend
Tabs --> TabThemes["Themes"]:::frontend
Tabs --> TabLCH["Core Palette"]:::frontend
Tabs --> TabCSS["Style Overrides"]:::frontend
Tabs --> TabCanvas["Canvas FX"]:::frontend
Tabs --> TabBG["Gradient"]:::frontend
Tabs --> TabCode["CSS Output"]:::frontend
DocsBtn["📖 Docs Button"]:::frontend --> DocsModal["Documentation Modal (22 sections)"]:::frontend
TabThemes --> CommitChange["commitChange()"]:::frontend
TabLCH --> CommitChange
TabCSS --> CommitChange
TabCanvas --> CommitChange
TabBG --> CommitChange
CommitChange --> GenerateCSS["generateCoreCSS()"]:::frontend
GenerateCSS --> SyncToServer["syncToServer() — POST /theme-designer"]:::frontend
SyncToServer --> RouteSave
end
⚠️ Important Notes & System Requirements
- Required Open WebUI Version:
0.11.0or higher — 1.7.0 relies on the pre-toggle lifecycle events and on/static/loader.js+/static/custom.cssbeing loaded by the frontend. - Admin access required — the designer page and save endpoint enforce admin authentication.
- Server write access — only
DATA_DIR/theme/is needed, for the persistence files. As of 1.7.0 the function never writes to the frontend build, so a read-only frontend is fine. (One exception: on first run after upgrading from 1.6.2 or earlier it tries once to remove that version's leftoverindex.htmlblocks, and logs a warning and continues if it can't.) - No sandbox flags needed — unlike the Tool variant, no "Same Origin" iframe configuration is required.
- No additional Python dependencies — uses only what Open WebUI provides (
pydantic,starlette). - Multi-worker deployments — SSE broadcasting works across workers automatically when
REDIS_URLis set (which Open WebUI already uses for WebSocket relay). No additional configuration needed.
License
Support: If you love this tool, consider supporting Open WebUI or buying me a coffee.