Skip to Content

Make a Theme

A full light and dark theme from one brand colour, checked for WCAG contrast.

Install

npm i @dapplelight/signet-tokens

Generate it from the CLI

bun path/to/signet/packages/cli/src/index.ts theme "#e11d48" --base cinematic > src/brand.css

Import src/brand.css in place of the base theme.

Or build it in code

scripts/theme.ts
import { buildTheme, toCss, toDesignTokens, toFigmaVariables } from "@dapplelight/signet-tokens/theme"

const theme = buildTheme({ brand: "#e11d48", base: "cinematic" }) // mode: "light" | "dark" | "both"
console.log(toCss(theme))           // overrides the base's colours in light and dark
console.log(theme.adjustments)      // tokens moved to reach WCAG 4.5:1 (text) or 3:1 (focus, charts)
const json = toDesignTokens(theme)   // W3C Design Tokens JSON
const figma = toFigmaVariables(theme) // body for Figma's POST /v1/files/:key/variables

A pale brand comes back darker in light mode, with the change listed.

Write one by hand

src/brand.css
@import "@dapplelight/signet-tokens/editorial.css";

@theme inline {
  --color-primary: #e11d48;
  --color-primary-foreground: #ffffff;
  --color-ring: #e11d48;
}

Keep every variable the contract lists; @dapplelight/signet-ui reads only those.

Next