resolveGradient

Commons
stable

Normalise a gradient value (preset key, CSS gradient string, or IGradient object) into a CSS gradient string for use in background-image or text-clip. Returns an empty string for non-gradient inputs.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

value
requis
TColor | IGradient
The gradient input: a preset key string (e.g. "preset:aurora"), a raw CSS gradient string (linear-gradient/radial-gradient/…), an IGradient config object, or any other value (returns empty string).

API

Valeur de retour

La valeur retournée par cet util.

A CSS gradient string (preset token var or inline gradient expression), or an empty string when the input is not a gradient.

Usage

Exemples

Extraits de code prêts à coller.

Resolve preset and raw gradient values

typescript