Border specification for container and widget styling.
A border has three properties:
color- hex color string (e.g."#ff0000").nilmeans no color override.width- border width in pixels. Default:0.radius- corner radius. Either a uniform number or a per-cornerradius_map()fromradius/4. Default:0.
Wire format
The encoded border is a map:
%{color: "#ff0000", width: 2, radius: 8}Radius can be a uniform number or a per-corner map:
%{top_left: 8, top_right: 8, bottom_right: 0, bottom_left: 0}Example
border = Plushie.Type.Border.new()
|> Plushie.Type.Border.color("#3366ff")
|> Plushie.Type.Border.width(2)
|> Plushie.Type.Border.rounded(8)
Summary
Functions
Sets the border color. Accepts a hex string or named color atom.
Encodes a border to the wire format.
Constructs a Border from a keyword list.
Creates a new border with default values (no color, zero width, zero radius).
Creates a per-corner radius map.
Sets a uniform corner radius in pixels.
Sets the border width in pixels.
Types
@type radius_map() :: %{ top_left: number(), top_right: number(), bottom_right: number(), bottom_left: number() }
Per-corner radius map.
@type t() :: %Plushie.Type.Border{ color: Plushie.Type.Color.t() | nil, radius: number() | radius_map(), width: number() }
Border specification with color, width, and radius.
Functions
@spec color(border :: t(), color :: Plushie.Type.Color.input()) :: t()
Sets the border color. Accepts a hex string or named color atom.
Encodes a border to the wire format.
Constructs a Border from a keyword list.
@spec new() :: t()
Creates a new border with default values (no color, zero width, zero radius).
@spec radius( top_left :: number(), top_right :: number(), bottom_right :: number(), bottom_left :: number() ) :: radius_map()
Creates a per-corner radius map.
Sets a uniform corner radius in pixels.
Sets the border width in pixels.