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

VariableDefault
--backgroundlight-dark(oklch(1 0 0), oklch(0.145 0 0))
--foregroundlight-dark(oklch(0.145 0 0), oklch(0.985 0 0))
--mutedlight-dark(oklch(0.97 0 0), oklch(0.269 0 0))
--muted-foregroundlight-dark(oklch(0.556 0 0), oklch(0.708 0 0))
--cardlight-dark(oklch(1 0 0), oklch(0.205 0 0))
--card-foregroundvar(--foreground)
--popoverlight-dark(oklch(1 0 0), oklch(0.205 0 0))
--popover-foregroundvar(--foreground)
--primarylight-dark(oklch(0.205 0 0), oklch(0.922 0 0))
--primary-foregroundlight-dark(oklch(0.985 0 0), oklch(0.205 0 0))
--secondarylight-dark(oklch(0.97 0 0), oklch(0.269 0 0))
--secondary-foregroundvar(--foreground)
--accentlight-dark(oklch(0.97 0 0), oklch(0.269 0 0))
--accent-foregroundvar(--foreground)
--destructiveoklch(0.577 0.245 27.3)
--destructive-foregroundoklch(0.985 0 0)
--destructive-textlight-dark(oklch(0.577 0.245 27.3), oklch(0.704 0.191 22.2))
--borderlight-dark(oklch(0.922 0 0), oklch(1 0 0 / 10%))
--inputlight-dark(oklch(0.922 0 0), oklch(1 0 0 / 15%))
--ringlight-dark(oklch(0.708 0 0), oklch(0.556 0 0))
--radius0.5rem
--z-dropdown1000
--z-overlay1100
--z-dialog1200
--z-popover1300
--z-toast1400
--z-tooltip1500
--duration-fast120ms
--duration-normal200ms
--duration-slow300ms
--duration-spring500ms
--motion-enter-scale0.96
--motion-enter-offset8px