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
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- gradientrequiredstring
- A CSS gradient value that may contain design-system color names (e.g. `"to right, primary, success"`) and/or `rgba(#hex, alpha)` shorthand.
- colorsrequiredRecord<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
Return value
The value returned by this 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
Examples
Ready-to-paste usage snippets.
Resolve named colors in a gradient