Core Engine
Three orthogonal systems. Each takes one input. Everything else derives.
Set --_color. Eight functions derive everything. --_dark flips mode. --_bg tracks background for auto contrast.
| Function | Signature | Returns |
|---|---|---|
--surface | (level, color) | background at perceptual depth |
--fill | (level, color) | interactive color, full chroma |
--contrast | (amount, bg) | text — auto light/dark direction |
--alpha | (opacity, base) | transparent variant |
--shadow | (level, color) | colored box-shadow |
--hue | (angle, color) | hue-rotated color |
--mute | (amount, color) | desaturated variant |
--vibrant | (amount, color) | boosted chroma variant |
Three transforms feed --_color. Set one on any element — every descendant re-derives surfaces, fills, contrast, and shadows from the new color.
--hue(180)
--mute(0.6)
--vibrant(.8)
Set --_surface explicitly, or use class="surface" to auto-increment depth. --_bg is computed once per boundary — children inherit it for free.
Set --_type on any element. One number activates fluid size, tightened tracking, compressed leading. Unset elements inherit normally.
| Mechanism | Formula | Effect |
|---|---|---|
| Size | --type(step) × --_type-scale | geometric fluid scale |
| Tracking | 0.01em − step × 0.01em | tighter at large sizes |
| Leading | 1.5 − step × 0.075 | compressed at large sizes |
| Scale | --_type-scale (default 1) | global multiplier |
-1Small — captions, labels0Base body text1Subheading2Section3Heading5Display--space(step) — fluid geometric spacing. Same engine as type. Scaled by --_space-scale.
-2-1012345The three systems compose naturally. A card uses all three:
Card title
Body text at 0.7 contrast.
Muted caption at 0.4.
| Property | Type | Inherits | Default |
|---|---|---|---|
--_color | <color> | yes | purple |
--_dark | 0 | 1 | yes | 0 (auto) |
--_bg | <color> | yes | white |
--_surface | <integer> | no | -999 (off) |
--_type | <number> | no | -999 (off) |
--_motion | 0 | 1 | yes | 1 (auto) |
--_type-scale | <number> | yes | 1 |
--_space-scale | <number> | yes | 1 |
| Function | Signature | Returns |
|---|---|---|
--surface | (level: 0, color: --_color) | <color> |
--fill | (level: 0, color: --_color) | <color> |
--contrast | (amount: 0.85, bg: --_bg) | <color> |
--alpha | (opacity: 0.5, base: --_bg) | <color> |
--shadow | (level: 1, color: --_color) | <shadow> |
--hue | (angle: 180, color: --_color) | <color> |
--mute | (amount: 0.5, color: --_color) | <color> |
--vibrant | (amount: 0.5, color: --_color) | <color> |
--type | (step: 0) | <length> |
--space | (step: 0) | <length> |