Skip to content

Colors

Your colors, light and dark, and the nine palettes

Blocks only use the shadcn color variables from your globals.css, such as --background, --card and --primary. So a block takes on your colors, and installing one changes nothing you already have.

Which variables to set

No theme yet? Set --background, --foreground, --primary, --muted, --muted-foreground and --border. The rest follows from those.

Stick to the variables

A fixed color like bg-zinc-900 does not change with the theme, so it looks wrong in dark mode. Use bg-background, text-muted-foreground and so on.

Buttons

Buttons use --cta, which is --primary unless you change it. Set --cta to give your buttons a different color.

Bright button colors

--cta-rim-top and --cta-rim-bottom are tuned for a near-black button. With a bright one, lower them to about 0.03 and 0.075.

Matching the previews

To get exactly the colors from the previews, add the theme:

npx shadcn@4.21.4 add @divplate/theme

It replaces your shadcn color variables, light and dark, sets --radius to 1rem and sets --font-sans to Geist. See Corners and Typography.

It recolors every shadcn component you already have, not just ours.

Light and dark

A section follows your site's theme. Use scheme to keep it one way:

ValueWhat it does
autoFollows the theme toggle
lightAlways light, even on a dark page
darkAlways dark, even on a light page
<Footer01 section={{ scheme: "dark" }} />

Palettes

A palette is another set of colors for the same blocks. The picker on the previews switches between nine of them, and each one installs on its own:

npx shadcn@4.21.4 add @divplate/palette-blue

The nine are palette-purple, palette-blue, palette-turquoise, palette-green, palette-yellow, palette-brown, palette-orange, palette-red and palette-pink.

Turn one on with an attribute. Put it on <html> for the whole site, or on a single element:

<section data-palette="blue">…</section>

Everything inside follows it, in light and dark, buttons included.

Making your own

Only override what your palette changes:

app/globals.css
[data-palette="lime"] {
  --background: oklch(0.994 0.003 130);
  --foreground: oklch(0.18 0.012 135);
  --muted: oklch(0.965 0.006 130);
  --border: oklch(0.915 0.008 130);
  --primary: oklch(0.68 0.17 130);
  --primary-foreground: oklch(0.99 0 0);
  --ring: oklch(0.68 0.17 130);
  --cta: oklch(0.68 0.17 130);
  --cta-foreground: oklch(0.995 0 0);
}

.dark[data-palette="lime"],
[data-palette="lime"] .dark,
.dark [data-palette="lime"] {
  --background: oklch(0.168 0.004 135);
  --foreground: oklch(0.97 0.005 130);
  --muted: oklch(0.28 0.014 135);
  --border: oklch(1 0 0 / 12%);
}

Keep all three dark selectors. Without the middle one, a palette on <html> stops working inside a section set to dark.

Some values are relative

A few tokens are set relative to another one. --surface, for example, is the page background plus a small step. Copy its number into a palette with a lighter background and the secondary button loses its top edge.

Name your palette after its color, like lime. That is the word people and agents will guess first.