Theme Configuration
Configure your theme with defineTheme.
defineTheme
The theme config file:
import { createTheme } from "threeu-sdk/theme";
import HomePage from "./pages/Home";
import ProductPage from "./pages/Product";
export default createTheme({
name: "Modern Luxury",
slug: "modern-luxury",
visibility: "public",
pages: { home: HomePage, product: ProductPage }
});Brand Identity: Logo, Palette & Banners
Merchants set their identity once in the ThreeU dashboard: a logo, up to six banner images (hero/slider art, in display order) and a 60/30/10 palette (primary 60% dominant, secondary 30% surfaces, accent 10% calls-to-action) auto-extracted from those images and editable. The storefront config exposes it as config.brand (logo_url, banners[], primary_color, secondary_color, accent_color) and the SDK turns it into the provider's brand object:
import { ThreeuStorefront } from "threeu-sdk/storefront";
import { ThemeProvider, brandInfoFromConfig } from "threeu-sdk/theme";
const storefront = new ThreeuStorefront({ brand: "my-store", publicToken: PUBLIC_KEY });
const config = await storefront.getConfig();
<ThemeProvider brand={brandInfoFromConfig(config, { locale: "ar" })} storefront={storefront}>
<App />
</ThemeProvider>Palette CSS Variables
When brand.colors is present the provider writes CSS custom properties on <html> (and removes them on unmount), so plain CSS and Tailwind arbitrary values can follow the merchant's palette with no JavaScript:
| Variable | Value |
|---|---|
--brand-primary, --brand-secondary, --brand-accent | The colour as set by the owner (only roles they set) |
--brand-<role>-foreground | #000000 or #ffffff, whichever contrasts better |
--brand-<role>-50 … --brand-<role>-950 | Lightness ladder (50 near white, 500 = base, 950 near black); hex colours only |
Always give a fallback (var(--brand-primary, #123456)) — a brand that never set a role keeps your theme's colour. brandCssVars(colors) returns the same map for SSR or inline styles, and applyBrandCssVars(colors, element) targets a specific element. Inside the hosted ThreeU storefront the same variables are provided by the host, so merged themes behave identically.