Generate Design Systems Programmatically
Generate entire color palettes, spacing scales, or typographic systems.
TokenScript
// Generate a 9-step color ramp from a brand color
variable brand: Color = #3B82F6;
variable brandHsl: Color.Hsl = brand.to.hsl();
variable ramp: List;
variable step: Number = 1;
variable stepValue: Number;
variable lightness: Number;
variable key: String;
while (step <= 9) [
stepValue = step * 100;
lightness = 95 - (step * 10);
key = "blue-".concat(stepValue.to_string());
ramp = ramp.append(hsl(brandHsl.h, brandHsl.s, lightness));
step = step + 1;
]
return ramp;
Result
Everything You Need
From language basics to production deployment, we've got you covered.
📖
Language Specification
Complete reference for syntax, types, control flow, and functions. Learn how the interpreter executes your token logic.
Learn more🔌
Why TokenScript?
Understand the problems TokenScript solves and when to use it in your design system workflow.
Learn moreâš¡
Quick Start
Get started with TokenScript in minutes. Install, write your first script, and start automating your token workflows.
Learn more