Families and themes

The components say what something is. A family says how it looks. You choose a family, then tune it lightly with a theme; you never restyle a component from scratch to get a coherent look.

A family

A family is an opinionated visual direction, compiled to one stylesheet that draws every component it styles. Changing family is changing that stylesheet, never the markup.

import '@sepale/style/daisy.css';      /* before */
import '@sepale/style/peony.css';      /* after: the same markup, another look */
import '@sepale/style/peony/themes/iris.css';

Each family is self-contained: it reads nothing from another one, so two families can differ as much as they like — a flat one, a hand-drawn one, a glassy one. The cost is accepted on purpose: a family does not have to ship every variant another one has. The description of the family picked in the sidebar says what it is after and what it exposes.

Parameters

A parameter is a custom property the family exposes for tuning: colours, radii, and the family's own knobs (a shadow offset, a wobble, a blur). Each family decides its own set. One may expose fifteen background colours, another none; sharing a name between two families is a convenience, never a rule.

A theme

A theme is a named set of values for one family's parameters, and belongs to that family: it can only set what its family exposes. A theme is a stylesheet too, loaded after the family. Since parameters are custom properties, any of them can be overridden by hand, for the whole page or for one part of it.

/* After the theme: a parameter is a custom property */
:root {
  --color-primary: oklch(55% 0.2 250);
}

/* or for one part of the page only */
.checkout {
  --color-primary: oklch(60% 0.18 150);
}

Sizes follow the text

Every component is sized in em, from its own font size: a button in a larger context grows with it, without a breakpoint. A size variant (sm, lg…) only sets that font size. The type scale is fixed, a ratio of 1.125 on a base of 1rem; a family's --scale may grow the frames — paddings, gaps — never the text.

Make your own theme

The theme generator edits every parameter of the family picked in the sidebar, on a live preview, and downloads the result as a theme.css to load after the family.