A palette exporter translates design data into a portable text representation. Keep stable token names so a cosmetic rename does not break consuming styles.
Worked example
// components/PaletteTokenExporter.tsx
export default function PaletteTokenExporter({
hex = "#bc805a",
}: { hex?: string } = {}) {
return (
<a
download="palette.css"
href={"data:text/css," + encodeURIComponent(":root { --accent: " + hex + "; }")}
>
Download colour token
</a>
);
}Implementation notes
Validate exported token names for the destination format. A human-friendly name with spaces may need a different representation in a CSS custom property.
Try it yourself
Export two colours with similar human-readable labels and inspect the names.
Open the React example →Editorial date July 5, 2025 · Published December 6, 2026