Skip to content

Theming

The Maho Storefront uses a JSON-driven theming system where design tokens defined in theme.json are transformed into CSS custom properties at build time. Combined with DaisyUI v5's semantic class system and UnoCSS utilities, themes can be created and switched without writing any CSS.

How It Works

  1. Define tokens in theme.json — colors, fonts, spacing, radii, shadows
  2. Build step reads tokens and generates CSS custom properties in :root
  3. DaisyUI components consume semantic color tokens (--color-primary, etc.)
  4. UnoCSS utilities use the same tokens for consistency
  5. Multi-theme support via [data-theme] CSS scoping

Theme Files

FilePurpose
theme.jsonDefault theme (required)
theme-{name}.jsonAdditional themes (e.g., theme-tech.json)
stores.jsonMaps store codes to theme files
uno.config.tsTransforms tokens → CSS

Token Categories

CategoryExamplesCount
Colorsprimary, accent, bg, text~30
Fontssans, heading, mono3
TypographybaseFontSize, h1Size, headingWeight~11
Space0 through 24 (0px–96px)~24
Breakpointssm through 2xl5
SizesheaderHeight, contentMax, drawerWidth~24
Radiixs through full7
Shadowsxs through xl5
Transitionsfast, base, slow3
ComponentsButton, card, badge, input radii/styles~12

Themes in Action

The same storefront codebase with different theme.json tokens:

Default (Fashion)Tech Theme
Default themeTech theme

Multi-Theme Architecture

Each store in stores.json references a theme file. At build time, UnoCSS generates CSS for all themes:

css
/* Default theme */
:root {
  --color-primary: #111111;
  --color-accent: #ff2d87;
  /* ... */
}

/* Tech theme */
[data-theme="tech"] {
  --color-primary: #0a0a0a;
  --color-accent: #00d4ff;
  /* ... */
}

Runtime switching: document.documentElement.setAttribute('data-theme', 'tech')

Next Steps