Theming
Generate the theme from one brand color, pick the gray temperature, and switch light and dark.
Nelumbo's whole color scheme comes from three settings: a brand accent, a neutral temperature and an accent vibrance. From them it builds tonal palettes in HCT (Material's hue, chroma and tone color space) and picks every role by tone, so contrast holds whatever the brand is.
Open Customize theme in the sidebar to try settings live. The docs recolor with them.
Generate a theme
In a checkout of Nelumbo:
npm run theme -- --brand green --neutral warm| Option | Values | Default |
|---|---|---|
--brand | An accent name (blue, cyan, green, amber, orange, red, pink, purple) or a hex color | blue |
--neutral | pure, warm or cool | pure |
--vibrance | 0.5 to 1.4, how saturated the accents are | 1 |
It writes src/styles/nelumbo.css and the theme item of the registry. Copy the CSS into your project, or
build the registry (npm run registry:build) and install @nelumbo/theme from it.
Color roles
Every shadcn variable is there (background, foreground, primary, secondary, muted, accent, border,
input, ring, destructive, sidebar-*, chart-*), so shadcn components work unchanged. Nelumbo adds:
- Surfaces.
surface-container-lowesttosurface-container-highest, five steps of gray for layers. Raised layers read lighter in dark mode, the way lit objects do. - Accents. Each accent has four roles:
blue,blue-foreground,blue-containerandblue-container-foreground, and the same for every hue, plusbrand,success,warninganddestructive. - Inverse.
inverse-surfaceandinverse-foreground, for snackbars and tooltips. - Outlines.
outlineandoutline-variant.
See Color, depth and motion for all of them in use.
Dynamic color
Components are neutral by default. Set data-color="dynamic" on any element to give the components inside it
the brand accent instead, and data-color="neutral" to turn it off again further down:
<section data-color="dynamic"> <Switch /> {/* brand accent */} <Button>Save</Button> {/* still neutral */}</section>katalyx.bio uses this to give the Farfa page blue and the Nera page green, the apps' own brand colors.
Light and dark
The theme defines both: :root is light, .dark is dark. Toggle the dark class on <html> (next-themes
does this for you), and set color-scheme to match so scrollbars and form controls follow.
Tokens
Beyond color, the theme sets:
- Radius.
--radiusand the shape scale. See Shape. - Elevation.
shadow-e1toshadow-e4, two-layer shadows. - Type roles.
type-display-*,type-headline-*,type-title-*,type-body-*andtype-label-*utilities. See Typography. - Interaction. The
state-layerutility (hover, focus and press overlay) andtactile(press squeeze with a spring release).