pub fn parse_with(
v: &Value,
refs: Option<&mut NameRefs<'_>>,
) -> Result<Gradient, String>Expand description
Reads a gradient from plain data, the form every binding carries:
{ to = "bottom", stops = {…} }— a side or a corner (Side);{ angle = 0.125, stops = {…} }— turns clockwise from east;{ radial = true, at = {0.5, 0}, stops = {…} }—atoptional.
No to, angle or radial is to = "bottom". A stop is a colour —
0xRRGGBBAA, "#hex", or with refs a $name — or a
{colour, position} pair. A $name that misses is remembered on the
refs for the binding to raise, and its stop is left out, as a miss
leaves any slot: fewer than two stops in the list is an error, but a
list left with fewer once the misses are out parses, and draws nothing
(ADR 0042’s amendment, weighed again for backlog RG118).