A typed span for Plushie.Widget.RichText.
Each span carries one segment of text with its own optional
styling. Construct one with new/1 and chain setters, or pass a
plain map (the renderer accepts both):
alias Plushie.Widget.RichText.Span
Span.new("Hello ")
|> Span.color("#003366")
|> Span.size(18.0)
|> Span.font(Plushie.Type.Font.new(weight: :bold))Spans are encoded to the wire as maps with snake_case keys. Unset fields are omitted so the renderer falls back to the rich_text widget's default styling for that property.
Summary
Types
Highlight backdrop drawn behind a span. background paints a
solid colour; border adds a stroke around the highlighted
region.
Functions
Set the text colour.
Encode a span (or plain map) to its wire form.
Set the font.
Set the highlight backdrop. Accepts a Plushie.Type.Color
(background only) or a map with :background and/or :border.
Set the line height.
Set a hyperlink URL the renderer emits as link_click.
Build a span with the given text and no style overrides.
Set the padding around the span's text.
Set the font size (pixels).
Toggle the strikethrough decoration.
Toggle the underline decoration.
Types
@type highlight() :: %{ optional(:background) => Plushie.Type.Color.t(), optional(:border) => Plushie.Type.Border.t() }
Highlight backdrop drawn behind a span. background paints a
solid colour; border adds a stroke around the highlighted
region.
@type t() :: %Plushie.Widget.RichText.Span{ color: Plushie.Type.Color.t() | nil, font: Plushie.Type.Font.t() | nil, highlight: highlight() | nil, line_height: Plushie.Type.LineHeight.t() | nil, link: String.t() | nil, padding: Plushie.Type.Padding.t() | nil, size: number() | nil, strikethrough: boolean() | nil, text: String.t(), underline: boolean() | nil }
Functions
@spec color(t(), Plushie.Type.Color.input()) :: t()
Set the text colour.
Encode a span (or plain map) to its wire form.
@spec font(t(), Plushie.Type.Font.t()) :: t()
Set the font.
@spec highlight(t(), Plushie.Type.Color.input() | highlight()) :: t()
Set the highlight backdrop. Accepts a Plushie.Type.Color
(background only) or a map with :background and/or :border.
@spec line_height(t(), Plushie.Type.LineHeight.t() | number() | map()) :: t()
Set the line height.
Set a hyperlink URL the renderer emits as link_click.
Build a span with the given text and no style overrides.
Set the padding around the span's text.
Set the font size (pixels).
Toggle the strikethrough decoration.
Toggle the underline decoration.