Interactive theme builder

Pick a brand palette, corner radius, and font below, then copy the generated theme.ts or scaffold it with the CLI.

1. Brand palette

2. Corner radius

3. Typography & mode

CLI quick start
npx @reactloom/cli init --accent indigo --radius default --yes

Brand preview

Live tokens applied to your component subtree.

src/theme.ts
import { createTheme, type ColorScale } from '@reactloom/theme';

const accent: ColorScale = {
  "50": "#EEF2FF",
  "100": "#E0E7FF",
  "200": "#C7D2FE",
  "300": "#A5B4FC",
  "400": "#818CF8",
  "500": "#6366F1",
  "600": "#4F46E5",
  "700": "#4338CA",
  "800": "#3730A3",
  "900": "#312E81",
  "950": "#1E1B4B"
};

export const brandTheme = createTheme({
  name: 'brand',
  base: 'light',
  palettes: { accent },
  radius: { md: '6px', lg: '10px' },
  fontFamily: { sans: "'Inter Variable', ui-sans-serif, system-ui, sans-serif" },
});

Built-in themes

  • light — the default.
  • dark — tuned surfaces and stronger shadows.
  • high-contrast — 7:1 text, 2 px borders, no shadows.
  • system — follows the OS through a CSS media query, so server and client markup are identical.

Use the theme switch in the header to see every page in each theme.

Brand themes

createTheme

Replace the accent palette; buttons, links, focus rings and selection re-derive from it.

Preview
Example.tsx
import { ThemeProvider, createTheme, type ColorScale } from '@reactloom/theme';
import { Button, HStack, Input, Stack, Switch } from '@reactloom/ui';

const teal: ColorScale = {
  50: '#EFFCF9', 100: '#C9F5EC', 200: '#95EBDA', 300: '#59D8C3', 400: '#2BBCA8', 500: '#14A08F',
  600: '#0D7F73', 700: '#0F665D', 800: '#11514B', 900: '#12443F', 950: '#042826',
};

const brand = createTheme({ name: 'acme', palettes: { accent: teal }, radius: { md: '4px' } });

export default function Example() {
  return (
    <ThemeProvider theme={brand} transparent style={{ width: '100%', maxWidth: 380 }}>
      <Stack gap="4">
        <Input label="Workspace" defaultValue="acme-inc" />
        <Switch label="Enable audit log" defaultChecked />
        <HStack>
          <Button>Save</Button>
          <Button variant="outline">Preview</Button>
        </HStack>
      </Stack>
    </ThemeProvider>
  );
}

Scoping and nesting

A ThemeProvider renders an element with data-pl-theme; nested providers theme regions, such as a dark sidebar.

Nested scopes

Preview

Light scope

Dark scope

Example.tsx
import { ThemeProvider } from '@reactloom/theme';
import { Button, Card, SimpleGrid } from '@reactloom/ui';

function Panel({ title }: { title: string }) {
  return (
    <Card>
      <Card.Title>{title}</Card.Title>
      <Card.Footer justify="start">
        <Button size="sm">Primary</Button>
        <Button size="sm" variant="secondary">Secondary</Button>
      </Card.Footer>
    </Card>
  );
}

export default function Example() {
  return (
    <SimpleGrid minChildWidth="14rem" gap="4" style={{ width: '100%' }}>
      <ThemeProvider defaultTheme="light" style={{ padding: 16, borderRadius: 12 }}>
        <Panel title="Light scope" />
      </ThemeProvider>
      <ThemeProvider defaultTheme="dark" style={{ padding: 16, borderRadius: 12 }}>
        <Panel title="Dark scope" />
      </ThemeProvider>
    </SimpleGrid>
  );
}

Runtime switching and persistence

tsx
const { theme, setTheme, colorScheme } = useTheme();

// Persistence is yours: controlled mode
<ThemeProvider theme={saved} onThemeChange={(t) => localStorage.setItem('theme', String(t))}>…</ThemeProvider>

Without React

The attribute alone themes server-rendered HTML before any JavaScript runs: <html data-pl-theme="dark">.