isGradient

Commons
stable

Returns true when the value is a CSS gradient string (linear-gradient, radial-gradient, …), a preset gradient name, or a gradient object descriptor. Excludes intents, hex colors, and transparent.

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
unknown
The raw value to test. Can be a string, object, or any other type. Strings are checked against CSS gradient syntax and preset names; objects are checked for a gradient descriptor shape.

API

Valeur de retour

La valeur retournée par cet util.

true when the value is recognised as a gradient (string or object form); false for intents, plain hex colors, transparent, null, or undefined.

Usage

Exemples

Extraits de code prêts à coller.

CSS gradient strings and non-gradient values

typescript