Theming
Every colour, radius and stacking level is a CSS variable in @nuecrea/core/tokens.css, exposed to Tailwind as utilities (bg-primary, rounded-lg, z-(--z-dialog)). Both frameworks read the same variables, so one theme styles both.
Create a theme
Override the variables after the tokens import. Give colours a light and a dark value with light-dark():
@import 'tailwindcss';
@import '@nuecrea/core/tokens.css';
:root {
--primary: light-dark(oklch(0.48 0.2 264), oklch(0.72 0.16 264));
--primary-foreground: oklch(0.985 0 0);
--ring: oklch(0.62 0.18 264);
--radius: 0.75rem;
}Override these raw variables only, not Tailwind's --color-* theme variables; those point at the raw ones.
Dark mode
Pages follow the system setting. Add class="dark" or class="light" to <html> to force a mode. The dark: variant follows the same rule.
Styling one component
Pass classes (className in React, class in Angular); they are added after the component's own. Style states with the data attributes listed on each component page, e.g. data-open:shadow-dialog. For a lasting change, edit the copied file in your app.
Tokens
| Variable | Default |
|---|---|
--background | light-dark(oklch(1 0 0), oklch(0.145 0 0)) |
--foreground | light-dark(oklch(0.145 0 0), oklch(0.985 0 0)) |
--muted | light-dark(oklch(0.97 0 0), oklch(0.269 0 0)) |
--muted-foreground | light-dark(oklch(0.556 0 0), oklch(0.708 0 0)) |
--card | light-dark(oklch(1 0 0), oklch(0.205 0 0)) |
--card-foreground | var(--foreground) |
--popover | light-dark(oklch(1 0 0), oklch(0.205 0 0)) |
--popover-foreground | var(--foreground) |
--primary | light-dark(oklch(0.205 0 0), oklch(0.922 0 0)) |
--primary-foreground | light-dark(oklch(0.985 0 0), oklch(0.205 0 0)) |
--secondary | light-dark(oklch(0.97 0 0), oklch(0.269 0 0)) |
--secondary-foreground | var(--foreground) |
--accent | light-dark(oklch(0.97 0 0), oklch(0.269 0 0)) |
--accent-foreground | var(--foreground) |
--destructive | oklch(0.577 0.245 27.3) |
--destructive-foreground | oklch(0.985 0 0) |
--destructive-text | light-dark(oklch(0.577 0.245 27.3), oklch(0.704 0.191 22.2)) |
--border | light-dark(oklch(0.922 0 0), oklch(1 0 0 / 10%)) |
--input | light-dark(oklch(0.922 0 0), oklch(1 0 0 / 15%)) |
--ring | light-dark(oklch(0.708 0 0), oklch(0.556 0 0)) |
--radius | 0.5rem |
--z-dropdown | 1000 |
--z-overlay | 1100 |
--z-dialog | 1200 |
--z-popover | 1300 |
--z-toast | 1400 |
--z-tooltip | 1500 |
--duration-fast | 120ms |
--duration-normal | 200ms |
--duration-slow | 300ms |
--duration-spring | 500ms |
--motion-enter-scale | 0.96 |
--motion-enter-offset | 8px |