Core concepts / Theming

Core concepts

Theming

Themes are plain TypeScript objects. Strata validates them at build time, generates CSS variables and gives you typed access to every token in your code.

Updated Sep 27, 2026 5 min readThemingTokens

Defining a theme

src/styles/tokens.ts
import { defineTheme } from "@strata/core";

export const aurora = defineTheme({
  colors: {
    brand: { light: "oklch(0.52 0.22 278)", dark: "oklch(0.7 0.17 282)" },
    surface: { light: "#ffffff", dark: "#0c0b14" },
  },
  radius: { sm: "4px", md: "8px", lg: "14px" },
  font: { sans: "Inter, system-ui", mono: "JetBrains Mono, monospace" },
});

Token scales

ScaleStepsUtility
spacing0 – 96 (0.25rem base)p-4, gap-6, mt-12
radiusnone, sm, md, lg, xl, fullradius-lg
elevation0 – 5elevation-2
textxs – 6xl (fluid)text-lg

Typed access in TypeScript

chart.ts
import { token } from "@strata/core";

// Autocompletes and errors on unknown paths
const series = token("colors.brand"); // "var(--st-brand)"

Multiple themes

Register more than one theme and switch with data-theme. Unchanged tokens are inherited from the first theme, so a variant only lists what differs.

Was this page helpful?

Last edited Sep 27, 2026 · docs/theming.mdx