gradientFromObject
Commons
stable
Converts a structured IGradient descriptor into a ready-to-use CSS gradient function string (linear-gradient, radial-gradient, or conic-gradient). Intent tokens (e.g. "primary") are resolved to the matching CSS custom property. Pure — no side effects.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- grequiredIGradient
- The gradient descriptor. Supports shorthand { from, to, direction } for two-stop gradients, or { stops } for multi-stop gradients. The type field defaults to "linear".
API
Return value
The value returned by this util.
- A CSS gradient function string ready to use as background-image or background value.
Usage
Examples
Ready-to-paste usage snippets.
Intent shorthand and multi-stop