Generator results at a style site (spec/02 §3.13): what a host's generator returned,
held to the type its position needs. A generator in a stack returns a style (a name, a
node or a list of them, with no generator and no gradient written in place); one at a
:color position returns a typed color or :none. A result of another type is a
fault at that site that applies nothing, the layers under it showing through; it
never fails the render. A generator that raises is a host bug and surfaces as one:
nothing here rescues it (visualize's three rescue sites are not carried over).
Calling a generator is Macaw.Draw.Generators.call/4's, its registry
Macaw.Draw.Generators.registry/1 (macaw_draw spec/07 §25); Macaw.Frame.Style.stack/4 calls it and
hands the result here.
iex> Macaw.Frame.Style.Generated.style(["warning", %{opacity: 0.5}])
{:ok, ["warning", %{opacity: 0.5}]}
iex> Macaw.Frame.Style.Generated.style(42)
{:error, {:generated, :style, 42}}
iex> Macaw.Frame.Style.Generated.color({:color, "bad"})
{:ok, {:color, "bad"}}
Summary
Functions
A generator's result at a :color position: {:ok, color} for a typed color, a literal
%Macaw.Layers.Color{} or :none; {:error, {:generated, :color, result}} otherwise.
A generator's result at a style stack: {:ok, stack} for a style name, a style node or
a list of them holding no generator and no gradient in place; {:error, {:generated, :style, result}} for anything else.
Functions
A generator's result at a :color position: {:ok, color} for a typed color, a literal
%Macaw.Layers.Color{} or :none; {:error, {:generated, :color, result}} otherwise.
A generator's result at a style stack: {:ok, stack} for a style name, a style node or
a list of them holding no generator and no gradient in place; {:error, {:generated, :style, result}} for anything else.