Skip to main content

CSS Variables

elorm/ui uses OKLCH color tokens defined in your global CSS file. All components reference semantic tokens like bg-primary, text-muted-foreground, and border-border. During elorm init, you choose a base color, accent, and radius. These are written to elorm.json and applied to your CSS scaffold automatically.

Token convention

We use semantic background and foreground pairs. The base token controls the surface color; the -foreground token controls text and icons on that surface. Given:
This component uses var(--primary) for background and var(--primary-foreground) for text:

Theme tokens

Radius scale

--radius is the base radius token. A scale is derived from it:
Init radius presets:

Base colors

Available base colors: neutral, zinc, slate, stone, gray. Apply a preset after init:

Accent colors

Available accents: default, blue, violet, green, orange, rose, amber, cyan. Accents update --primary, --ring, and chart tokens:

Dark mode

Add the dark class to your <html> element to enable dark mode tokens. Components automatically use the correct semantic colors.

Customizing tokens

Edit CSS variables in your global stylesheet. Components pick up changes without modifying individual files. To add a custom token, define it under :root and .dark, then expose it via @theme inline:
Always use semantic tokens in your own code — avoid raw color utilities like bg-blue-500.

Default theme scaffold

The following is the neutral default theme. Copy and adjust as needed:
Run elorm init to generate a complete scaffold tailored to your chosen base color and accent.