Bland.Theme (Elixir Technical Drawing v0.3.0)

Copy Markdown View Source

Theme presets and defaults.

A theme is a plain map of typographic, geometric, and stroke defaults. Every figure carries one; overrides can be applied to Bland.figure/1 via theme: or by merging maps directly.

Built-in themes

  • :report_1972 (default) — serif body text, thin black rules, inward-facing tick marks, framed plotting area.
  • :blueprint — Courier-style monospace labels, borderless axes, thicker stroke weights, evokes pencil-on-graph-paper.
  • :gazette — compact, high-contrast; title set in small caps, larger tick labels. Closer to a newspaper science column.

You can derive a theme with merge/2:

Bland.Theme.merge(:report_1972, %{font_family: "IBM Plex Serif"})

Summary

Functions

Returns the canonical default theme (:report_1972).

Fetches a named preset. name may be an atom preset or a map; maps are returned unchanged so you can pass theme: either way.

Merges an override map (or keyword list) into a named preset.

Applies a text transform declared by the theme (:upcase, :downcase, :none). Used by the renderer for titles and headings.

Types

t()

@type t() :: map()

Functions

default()

@spec default() :: t()

Returns the canonical default theme (:report_1972).

get(theme)

@spec get(atom() | t()) :: t()

Fetches a named preset. name may be an atom preset or a map; maps are returned unchanged so you can pass theme: either way.

merge(theme, overrides)

@spec merge(atom() | t(), map() | keyword()) :: t()

Merges an override map (or keyword list) into a named preset.

transform_text(text, arg2)

@spec transform_text(String.t(), atom()) :: String.t()

Applies a text transform declared by the theme (:upcase, :downcase, :none). Used by the renderer for titles and headings.