OpenProgram Docs

Theme system

CSS custom properties are the only runtime mechanism. Every built-in theme provides the same token set, and components never branch on a theme name.

CoversLeaves alone
Appearance and Font in SettingsComponent dimensions, layout, interaction
First frame, React hydration, system colour-scheme changesSaved user CSS overlays (never auto-rewritten beyond the selector migration)
Main window, desktop overlays, new windowsBusiness logic
Surfaces, text, borders, states, focus, composer, DAGSyntax highlighting, website content

From setting to component

  1. Select. Appearance: Mode (Auto, Light, Dark), theme pack, accent colour, CSS overlay. Font options come from font-pref.ts.
  2. Persist. Schema 3: agentic_theme_style + agentic_theme_mode; agentic_theme_accent; agentic_custom_css_enabled; agentic_tabrow_color. Fonts also keep a cookie for the first frame.
  3. Apply. The first-frame script and hook set data-theme, data-custom-css, accent tokens and --font-sans.
  4. Resolve. The pack's token file. Accent overrides three tokens; the overlay sits on top.
  5. Consume. The Tailwind bridge, CSS modules and desktop overlays read tokens.

Entry points: apps/web/lib/prefs/appearance/theme-pref.ts, apps/web/app/globals.css, apps/web/app/styles/themes/.

Theme packs

Packdata-theme--bg-primary--accent-fillPrimary
Beigebeige-dark
beige-light
#191918
#fbfaf8
#d97757
#c15f3c
Orange
Neutraldark
light
#1e1e20
#ffffff
#3b82f6
#2563eb
Blue
Auroraaurora
aurora-light
#171528
#fbfaff
#35b8a4
#0f766e
Teal, dark foreground on fills
Vividvivid
vivid-light
oklch tones of --tabrow-seedFollows the tab-strip colour

Vivid has Beige's panel layout. The strip colour is its own setting from Chrome's colour set, a pale tone of it in light mode. custom and custom-light remain as fallback ids and CSS files for old snippets, not as cards; custom-light.css matches beige-light.

Vivid's default seed (#3d475c) is in themes/fallback.css, so an application frame that loads only the themes still gets Vivid's colours.

Token contract

Theme files give values, components define use, and one purpose has one token name in every theme.

GroupTokens
Surface--bg-primary/secondary/tertiary --bg-input/hover/selected --surface-popover/tooltip
Text--text-bright/primary/secondary/muted --nav-color/hover
Boundary, depth--border --border-light --border-popover --shadow-* --scrim-*
Action, status--theme-accent --theme-accent-fill/fill-hover --accent-green/red/yellow --success-soft --warning-soft --danger-soft
Interaction--selection-bg --focus-ring --chip-bg/ring --meter-fill/track
Component roles--composer-surface/shadow --provider-icon-bg --dag-ghost
SettingSetsReachesNever
Appearancedata-themeBackgrounds, text, borders, shadows, states, tab focus, composer, popovers, DAG, desktop overlaysComponent-level [data-theme="light"]
Accent--accent-orange --accent-fill --accent-orange-hoverPrimary actions, selection borders, link colour on desktop error pages and directory listings. Empty means the pack's default.A fourth accent token
Font--font-sansbody, button, input, select, textarea, optgroup, except explicit mono regionsSystem font stacks in ordinary components
CSS overlay#user-custom-css + data-custom-cssSits on the current pack, behind the Enable switch; unset values come from the pack. Old [data-theme=custom] selectors are rewritten to data-custom-css.A separate skin card
Focus, active tab, pages in the centre card
AspectRule
Text entry, native selectOne existing border in the accent colour on focus: no outline, offset ring, box-shadow or size change. Search and composer wrappers own the border; their inner editor has none. Navigation, checkboxes, radios, sliders and embedded third-party surfaces keep their own keyboard focus.
Active desktop tabIn dark mode --tab-active-bg mixes the content background with 12% white, for ordinary tabs and split groups, stable on hover. Light mode and browser tabs use the content background.
Pages in the centre cardThe shell marks non-chat routes (.page-col) and panes ([data-page-surface]). A theme may restate --bg-secondary, --bg-tertiary and their derivatives for those scopes: beige-light uses #fbfaf8 and #f3f1ec, so pages read like the chat while the frame, rails and chat pane keep theme values.
Desktop windowAll theme ids pass unchanged to overlays; the window background is the pack's --bg-primary even with an accent override.
Diagnosing intermittent theme switches
AspectBehaviour
Desktop source of truthA complete valid theme-prefs.json from the main UI. Legacy browser-storage migration runs only when the file is missing or its mode or style is invalid. Raw browser-database scans cannot find the latest record, so they never override it or restore a cleared accent.
After loadThe web page's localStorage is the authority and syncs the desktop cache
What Auto followsIn the desktop App, the OS setting as the main process reads it (theme.systemDark, pushed on change). A debugger attached to the page can override prefers-color-scheme, and Playwright forces it to light on every page it adopts, so the App does not read it. In a browser, the media query.
Event logtheme-events.json under desktop userData, at most 64 records: message sends, first-screen init, settings changes, system colour events, cross-window sync, HTML attribute changes
Log contentsTimestamps, fixed event names, theme enums, system light or dark. No chat content, URLs, CSS or user paths. Write failures do not affect rendering.
LimitThe log identifies a switch's source; it does not establish that an unknown trigger is fixed
Options compared
OptionUseWhy, and what it lacks
CSS custom properties + data-themeAdoptedCascades through Web, CSS modules, Tailwind arbitrary values and same-origin overlays. Cannot catch a missing token, hence the static check.
Tailwind @themeBridge onlyNames tokens as utilities without a second set of values. Cannot generate imports; a script aligns theme files with TS ids.
JS theme object, ContextRejectedDuplicates values; misses native CSS, the first frame and Electron overlays
Component [data-theme] branchesRejectedEach new theme would miss edits
light-dark()RejectedExpresses only light and dark, not named packs

Basis: CSS Custom Properties Level 1, CSS Color Adjustment color-scheme.

Acceptance

AreaRequirement
SettingsLists Beige, Neutral, Aurora and Vivid
Web checksapps/web/scripts/settings/check-theme-contract.mjs keeps CSS imports, theme files and allowed overlay values in agreement and every built-in theme on one token set
Component CSSOutside theme files, no branch on a built-in theme name
FontsOrdinary text and native form controls inherit one --font-sans
AccentsPack defaults come from the CSS files
Installed AppInspect the main window, tabs, composer, popovers and overlays in dark, light and aurora
Windows testsNode's fileURLToPath converts module URLs, avoiding an extra slash before drive paths

Implementation status

Implemented: Mode × theme pack × accent × overlay, with THEME_STYLE_PAIRS as the light and dark matrix. Stored custom and custom-light migrate to beige, and saved CSS turns the overlay on. Composer, provider icons and DAG use role tokens only. Desktop first-paint details: Desktop chrome.

Last updated · 2026-11-25