refract v0.1 · beta
Getting started / Introduction

One base theme, refracted into every brand — and you see what changes before you ship.

A framework-agnostic theme compiler built for white-label and multi-tenant work: author one RawTheme, derive a brand child in a line with override(), and refract diff any change to see its blast radius before it ships. The same theme exports to CSS, SCSS, JSON or styled-components — the format is just an adapter. Flip a preset — every panel below re-renders from real, in-browser-compiled output.

RawTheme Model adapter CSS · SCSS · JSON · SC
Now showing Halcyon
you author raw.colors
refract renders real compiled classes

Left is authored input; right is a live component built from the classes refract emitted for it — compiled in your browser. Flip a preset in the top bar and both sides re-render from that theme. See how components compose ▸

Why refract

Most theming tools couple your design tokens to one output format and one framework. refract keeps the theme format-neutral — you author it once, and an adapter decides the format. Plain CSS variables give you tokens but no synthesis or composition; utility frameworks and CSS-in-JS token tools are excellent but commit you to their output target and runtime. See how refract compares to Tailwind, Panda, Style Dictionary and others.

One source, any format

Author once; adapters refract the same Model into CSS, SCSS, JSON tokens or styled-components — or write your own for any target (React Native, Compose, a token pipeline) against a stable defineAdapter contract. Not a fixed list — the format is a plugin. Framework-agnostic by construction; the Model holds no CSS syntax.

References, not copies

Recipes reference tokens by path. Override a base value and everything downstream re-flows — tonal palettes re-synthesize, no find-and-replace.

Composition, not duplication

A component is a class list composed from the other subsystems — one class, every layer, and the same surface across every adapter.

Build-time and run-time

Emit static files in CI, or compile in the browser and swap themes live with override() — exactly what this page does.

Agent-native

The design system an AI agent can't drift from: a fixed, named vocabulary plus a machine-readable contract it queries and validates against — installable skills, a versioned manifest, and fail-loud codes. The agent story ▸

Is refract for you?

No tool fits everything — here's the honest read, so you can tell fast.

Reach for refract if…
  • you ship one design system to multiple targets (web · SCSS · tokens · a component library) from a single source;
  • you do white-label / multi-tenant / per-request theming — runtime override() is built for it, and it's refract's strongest story (the white-labeling recipe ▸);
  • you want synthesized OKLCH ramps + composition, not hand-kept scales;
  • an AI agent authors your theme and it has to stay consistent.
You probably don't need it if…
  • it's a solo project happy with hand-written CSS variables — no synthesis or composition to gain;
  • you're all-in on a utility-first framework and want to stay in its own token system;
  • you only need to exchange tokens between design tools — an interchange format alone is simpler (refract speaks DTCG if you later want both);
  • you need production-proven stability today — refract is beta;
  • you're native-first — React Native / Compose adapters aren't here yet.
Technical documentation for @theme-registry/refract · all output is compiled client-side by the real library (CSS adapter). The chrome is theme-aware; the render panes carry each preset's own world. · MIT licensed.