Color Generators
Create consistent color systems with harmony palettes, perceptual scales, contrast generation, color mixing, gradients, and compositing.
Color Harmony
Generate harmonious color palettes based on color theory using /colorHarmony.
Balanced (Triadic/Tetradic)
Evenly distributes colors around the wheel. 3 steps = triadic (120° apart), 4 = tetradic (90° apart).
Complementary
Base + opposite on the color wheel. With steps > 2, creates a split-complementary fan.
Analogous
Adjacent colors clustered near the base hue. The distribution parameter controls spacing (default 10°).
Harmony types: complementary (base + opposite), analogous (clustered neighbors), balanced (evenly spaced).
Parameters: hue, steps, lightness, chroma, distribution.
Color Scales
Generate perceptual color scales with OKLCH interpolation using /colorScale.
Basic Scale with range()
Use range(start, end) for linear interpolation of lightness or chroma across steps.
Custom Stops
Use stops() for explicit values per step instead of linear interpolation.
Color Contrast
Automatically generate accessible text colors that meet WCAG or APCA contrast targets.
Against a Color Group
Generate one contrast color per background in a group. Each is guaranteed to pass the target.
Against Its Own Colors
Omit against, or write against = self, and the group's own colors are the backgrounds. Great for generating on-color variants for a scale.
Sampling Colors
sample says where the text colors come from: self (this group's own colors), $group (another group), or black-white (pure black or white, the default). From colors, it picks the one that passes with the least contrast to spare.
Inline Function
For a single token, use the inline colorContrast() function:
Contrast targets: wcag(aa) = 4.5:1 (default), wcag(aaa) = 7:1, wcag(3) = custom ratio, apca(75) = APCA Lc value.
Color Mixing
Mix two colors together to create blends, tints, and shade ramps.
Inline colorMix()
Mix two colors in a single expression. Arguments: color1, color2, ratio, space, hueMethod.
/colorMix Directive
Generate multiple mixed tokens across a range of ratios with /colorMix.
Gradients
Define gradient tokens with linear, radial, and conic types.
Gradient parameters: Linear uses angle, radial uses size + position,
conic uses from + position. All support repeating = true.
Next: Pipelines — transform, round, override, and rename generated token collections.