View Source Scenic.Primitive.Style.Paint.Color (Scenic v0.11.2)
Fill a primitive with a single color
The color paint is used as the data for the :fill
style.
data-format
Data Format
{:color, valid_color}
The full format is a tuple with two parameters. The first is the :color atom indicating that this is color paint data. The second is any valid color (see below).
valid-colors
Valid Colors
You can pass in any color format that is supported by the Scenic.Color.to_rgba/1
function.
This includes any named color. See the documentation for Scenic.Color
for more information.
Example:
graph
|> rect( {100,200}, fill: {:color, :blue} )
|> rect( {100,200}, stroke: {1, {:color, :green}} )
shortcut-format
Shortcut Format
valid_color
Because the color paint type is used so frequently, you can simply pass in any valid
color and the :fill
style will infer that it is to be used as paint.
Example:
graph
|> rect( {100,200}, fill: :blue )
|> rect( {100,200}, stroke: {1, :green} )