View Source ReflectOS.Kernel.Primitives (reflect_os_kernel v0.10.1)

Provides useful helpers for developing section UIs using Scenic.Scene on the ReflectOS platform.

Summary

Functions

Renders a QR code on the provided Scenic.Graph which encodes the given content string.

The "spec" version of qr_code/3, which allows it to be rendered later.

Renders a label for the given section graph given the common configuration fields of show_label? and label.

Renders a label for the given section graph given the label text.

Functions

Link to this function

qr_code(graph, content, opts \\ [])

View Source
@spec qr_code(graph :: Scenic.Graph.t(), content :: binary(), opts :: keyword()) ::
  Scenic.Graph.t()

Renders a QR code on the provided Scenic.Graph which encodes the given content string.

Uses the QRCodeEx library.

Options passed on for generating a QR Code:

  • :color
  • :background_color
  • :width

We recommend using the default colors, which renders a standard black and white QR code on a white background.

The default :width is 250px.

The remaining opts are passed on the underlying Scenic.Primitives.rect/3

Link to this function

qr_code_spec(content, opts \\ [])

View Source

The "spec" version of qr_code/3, which allows it to be rendered later.

See Scenic.Primitives for more information.

Link to this function

render_section_label(graph, config, opts \\ [])

View Source
@spec render_section_label(
  graph :: Scenic.Graph.t(),
  %{show_label?: boolean(), label: binary()},
  opts :: Keyword.t()
) :: Scenic.Graph.t()

Renders a label for the given section graph given the common configuration fields of show_label? and label.

Note that the section label must be called after the graph is complete.

See section_label/3 for available options.

Link to this function

section_label(graph, label, opts \\ [])

View Source
@spec section_label(graph :: Scenic.Graph.t(), label :: binary(), opts :: Keyword.t()) ::
  Scenic.Graph.t()

Renders a label for the given section graph given the label text.

Note that the section label must be called after the graph is complete.

Options are:

  • :width - A fixed width for the section, defaults to the width of the section or of the label text, whichever is greater.
  • align - The text alignment of the label, allowed values are :left, :center, and :right.