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

TokenWhat it controlsUsed by
background / foregroundDefault app background and textPage shell, sections
card / card-foregroundElevated surfacesCard, dashboard panels
popover / popover-foregroundFloating surfacesDialog, dropdown, select
primary / primary-foregroundHigh-emphasis actionsButton default, active states
secondary / secondary-foregroundLower-emphasis actionsSecondary buttons, badges
muted / muted-foregroundSubtle surfaces and textDescriptions, placeholders
accent / accent-foregroundHover and focus surfacesGhost buttons, menu highlights
destructiveDestructive actionsDestructive buttons, errors
borderDefault bordersCards, menus, separators
inputForm control bordersInput, textarea, select
ringFocus ringsAll focusable controls
chart-1chart-5Chart paletteDashboard charts
radiusBase corner radiusCards, inputs, buttons

Radius scale

--radius is the base radius token. A scale is derived from it:
Init radius presets:
PresetValue
default0.625rem
compact0.375rem
round0.75rem

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.