Skip to main content
Skip to content

Building a Tailwind color palette

Generate tokens in Palettebro, then register @palettebro/tailwind so class names stay semantic.

Tailwind 4 reads theme colors from CSS. The @palettebro/tailwind plugin maps a Palettebro palette onto those theme keys so you can use utilities like bg-surface-container instead of raw hex in every class.

1. Generate the palette

2. Register the plugin

Install @palettebro/tailwind and @palettebro/generator (Tailwind 4+, Node 22+). In your CSS entry:

@import "tailwindcss";

@plugin '@palettebro/tailwind' {
  primary: #412f9c;
  reverseLightDarkShades: true;
}

Optional fields match the generator: secondary, accent, variant, preset, and the same contrast / shade flags you set in the app.

3. Use semantic classes

<div className="bg-surface-container text-on-surface">
  Content
</div>

Prefer those names in components. If the brand hue changes, you change the plugin options — not every bg-* class.