parseGradient

Commons
stable

Resolve human-readable Vuetify/Origam color names embedded in a CSS gradient string (e.g. `"to right, primary, secondary"`) into real hex values, and expand short `rgba(#rrggbb, …)` syntax into valid CSS.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

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

gradient
requis
string
A CSS gradient value that may contain design-system color names (e.g. `"to right, primary, success"`) and/or `rgba(#hex, alpha)` shorthand.
colors
requis
Record<string, Record<string, string>>
A map of color families and their shades (e.g. `{ primary: { base: "#3b82f6", "lighten-1": "#60a5fa" } }`). Typically the current theme's color palette.

API

Valeur de retour

La valeur retournée par cet util.

The gradient string with all recognisable color names replaced by their hex values and `rgba(#hex, …)` converted to `rgba(r, g, b, …)` form.

Usage

Exemples

Extraits de code prêts à coller.

Resolve named colors in a gradient

typescript