Themes · authoring

Create a theme for the OS.

Create a theme that changes how the rumahl shell looks using RUI tokens. Start with a base theme, define light and dark values, then package the theme and try it in Settings.

15 min readUpdated 26 November 2026RUI · theme package

Use the tokens and parameters reference to choose roles before you add package files.

What a theme is

RUI is the operating-system design system. A theme is a resolved set of token values, a variant selection and optional metadata. The shell projects it onto the document root as --rumahl-ui-* custom properties. An app never needs to know which theme is active.

PartPurpose
id / nameStable identity and the label shown in Settings
tokensSemantic values for color, material, shape, motion, typography and layout
modesWhich appearance modes the theme supports: light, dark or both
variantsShell layout, launcher layout and window chrome
parametersOptional user-facing controls that tune a token
cssOptional presentation-only stylesheet
codeOptional theme module; sandboxed by default, full access only with explicit trust
previewOptional real preview image in a package

1. Author the theme

Use the public SDK when the theme lives in the RUI workspace. Omitted tokens fall back to the default base, so a theme is always complete.

theme.ts
import { defineTheme, registerTheme } from "@rumahl/ui/sdk";

export const ocean = registerTheme(defineTheme({
  id: "com.example.ocean",
  name: "Ocean",
  description: "A cool, low-contrast theme for dim rooms.",
  modes: ["light", "dark"],
  base: "iris",
  tokens: {
    "color.accent": "#0b6ea8",
    "color.accent.strong": "#3b9ad1",
    "color.canvas.background": "#071a24",
    "color.panel.background": "#0d2733",
    "color.text.primary": "#eaf4f9",
    "color.text.muted": "#9ab4c2",
    "color.outline": "#ffffff24",
    "shape.radius.window": "16px",
    "material.opacity": "0.72",
    "typography.display": "\"Fraunces Variable\", Georgia, serif"
  }
}));

Use base: "ground" only when the theme owns its presentation and should not inherit Iris chrome. For most themes, start with Iris and change tokens.

2. Choose tokens, not pixels

GroupTypical roles
color.*accent, accent.strong, on.accent, canvas, panel, surface, text.primary, text.muted, outline, shadow
material.*blur, saturation, opacity, morphism
shape.*window, dock, icon and control radii
motion.*duration and easing roles
typography.*UI and display families and the type scale
layout.*layout primitives for shell and app surfaces
texture.wallpaperwallpaper-aware surface treatment
icon.gradientsystem icon artwork

Do not hard-code a component color or radius. If a value is missing, add a semantic role to the theme contract rather than reaching into component CSS.

The complete token family and parameter reference is in Theme tokens and parameters.

3. Make a portable package

The OS installs a theme.json file or a ZIP with theme.json at its root (or one directory deep). A ZIP can name sibling styles.css, code.js and a preview image; their contents are inlined into the installed theme.

package layout
ocean/
  theme.json
  styles.css      # optional
  code.js         # optional
  preview.png     # optional
theme.json
{
  "id": "com.example.ocean",
  "name": "Ocean",
  "description": "A cool theme for dim rooms.",
  "version": "0.1.0",
  "author": "com.example",
  "modes": ["light", "dark"],
  "variants": {
    "shellLayout": "dock",
    "launcherLayout": "springboard",
    "windowChrome": "standard"
  },
  "tokens": {
    "color.accent": "#0b6ea8",
    "color.canvas.background": "#071a24",
    "color.panel.background": "#0d2733",
    "color.text.primary": "#eaf4f9",
    "shape.radius.window": "16px"
  },
  "css": "styles.css"
}

4. Keep the theme self-contained

A theme must render with the network disconnected. Remote fonts, images, stylesheets and scripts are not theme assets; they are dependencies that can fail, track the user or change after installation. The package already inlines styles.css and optional code.

ResourceDoDon’t
FontsA system stack or an OS-bundled faceGoogle Fonts, remote @font-face or @import
Images and wallpaperGradients, patterns and token-driven surfacesRemote background images, hotlinked wallpaper or a CDN
CSSLocal styles.css inlined by the packageurl(https://…) or a remote @import
CodePresentation-only theme lifecycle codefetch, XHR, WebSocket or a remote script
IconsBuilt-in RUI artwork or tokensA remote icon font or icon CDN
Previewpreview.png for the gallery onlyUsing the preview as a runtime background
don't: remote resources
@import url("https://fonts.googleapis.com/css2?family=Fraunces");
.hero {
  background-image: url("https://cdn.example/wallpaper.jpg");
}
do: system fonts and local CSS
/* Token values come from theme.json; the stylesheet stays local. */
.surface {
  font-family: var(--rumahl-ui-typography-ui);
  background-image:
    linear-gradient(135deg, #0d273300, #0d273366),
    repeating-linear-gradient(90deg, #ffffff08 0 2px, transparent 2px 8px);
}

preview.png is gallery metadata. Do not reference it as a runtime background; use tokens, gradients and CSS patterns instead.

If a visual idea seems to require a remote resource, it is not essential to the theme contract. Use a local fallback, a system asset or a token. A theme that cannot render offline is not ready to install.

5. Add tunable parameters

A parameter points at one token and asks the shell to render a control. Ranges are clamped; choices are discrete; colours can seed derived roles.

theme.json excerpt
"parameters": [
  {
    "kind": "range",
    "id": "corner",
    "token": "shape.radius.window",
    "min": 0,
    "max": 24,
    "step": 1,
    "label": { "en": "Window corners", "de": "Fensterecken" }
  },
  {
    "kind": "choice",
    "id": "material",
    "token": "material.blur",
    "options": [
      { "value": "6px", "label": { "en": "Calm" } },
      { "value": "36px", "label": { "en": "Deep glass" } }
    ],
    "label": { "en": "Glass depth" }
  }
]

Parameters that reference an unknown token are rejected. A theme can ship its own labels in English and German. See Tokens and parameters for the complete kinds and rules.

6. Test and install

  1. Open Settings → Display → Themes.
  2. Choose Install theme and select the .json or .zip package.
  3. Review the validation report. A code theme runs sandboxed by default; full shell access needs explicit consent and a trusted code hash.
  4. Select the theme, switch light/dark and test the parameter controls.
  5. Check a narrow window, long app titles, reduced motion and a high-contrast display.
  6. Uninstall or reset to verify the shell returns to a built-in theme cleanly.

Theme quality checks

  • Body and control text keep readable contrast in every supported mode.
  • Focus rings remain visible on every surface.
  • Reduced motion removes decorative motion without hiding content.
  • Long labels and German strings do not clip controls.
  • The theme does not depend on a particular wallpaper.
  • The theme renders with the network disconnected: no remote font, image, CSS or code request.
  • Every parameter writes only its declared token.
  • Uninstall restores the previous theme and preferences.

Public distribution

Themes are distributed through the same public store as apps at store.rumahl.com; package downloads and updates resolve to github.com/rumahl/apps. Local installation still exists for development, offline use and private themes.

Current limits

Theme certification, a support promise and theme-wide revocation rules are still missing.

Next