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.
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.
| Part | Purpose |
|---|---|
id / name | Stable identity and the label shown in Settings |
tokens | Semantic values for color, material, shape, motion, typography and layout |
modes | Which appearance modes the theme supports: light, dark or both |
variants | Shell layout, launcher layout and window chrome |
parameters | Optional user-facing controls that tune a token |
css | Optional presentation-only stylesheet |
code | Optional theme module; sandboxed by default, full access only with explicit trust |
preview | Optional 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.
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
| Group | Typical 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.wallpaper | wallpaper-aware surface treatment |
icon.gradient | system 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.
ocean/
theme.json
styles.css # optional
code.js # optional
preview.png # optional
{
"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.
| Resource | Do | Don’t |
|---|---|---|
| Fonts | A system stack or an OS-bundled face | Google Fonts, remote @font-face or @import |
| Images and wallpaper | Gradients, patterns and token-driven surfaces | Remote background images, hotlinked wallpaper or a CDN |
| CSS | Local styles.css inlined by the package | url(https://…) or a remote @import |
| Code | Presentation-only theme lifecycle code | fetch, XHR, WebSocket or a remote script |
| Icons | Built-in RUI artwork or tokens | A remote icon font or icon CDN |
| Preview | preview.png for the gallery only | Using the preview as a runtime background |
@import url("https://fonts.googleapis.com/css2?family=Fraunces");
.hero {
background-image: url("https://cdn.example/wallpaper.jpg");
}
/* 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.
"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
- Open Settings → Display → Themes.
- Choose Install theme and select the
.jsonor.zippackage. - Review the validation report. A code theme runs sandboxed by default; full shell access needs explicit consent and a trusted code hash.
- Select the theme, switch light/dark and test the parameter controls.
- Check a narrow window, long app titles, reduced motion and a high-contrast display.
- 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
- Themes overview — the four theme docs.
- Tokens and parameters — the complete contract.
- Package and install — theme.json, ZIP, trust and validation.
- Shell and UI contracts — how themes are applied.
Was this page helpful?