All articles
Back to Design docs
OS design system

RUI theming

How RUI themes are defined as data, registered with the theme SDK and projected onto the shell.

5 min read Updated: 20 October 2026
Markdown

Theme model

A theme is data: a validated set of tokens, optional CSS and safe templates. It is not arbitrary JavaScript and it does not replace shell behaviour.

  • id, name and supported modes
  • Token values for colour, material, shape, motion, typography, layout and texture
  • Optional theme-specific CSS
  • Safe slot templates where a theme may provide structure

Example

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

export const ocean = registerTheme(defineTheme({
  id: "com.example.ocean",
  name: "Ocean",
  tokens: {
    "color.accent": "#0b6ea8",
    "color.canvas.background": "#071a24",
    "color.panel.background": "#0d2733",
    "color.text.primary": "#eaf4f9",
    "shape.radius.window": "16px"
  },
  modes: ["light", "dark"]
}));

Runtime

  • ThemeProvider projects the active tokens onto the document root.
  • The shell resolves the theme from account and device preferences.
  • A theme switch produces a new configuration revision and stylesheet.
  • Components only read tokens, so no component rebuild is needed.

Reference

The Storybook theme toolbar and the theme guides demonstrate the active token set and registered themes.

Need the implementation? Open the design resources or the source repository.

On this page