Sigra.Branding.Profile (Sigra v1.1.0)

Copy Markdown View Source

Validated brand tokens shared by generated Sigra auth screens and emails.

A profile is intentionally small: it carries safe design tokens and common product metadata, not arbitrary HTML or CSS. Host apps that need full control should edit the generated components/templates directly.

Summary

Functions

Returns a validated profile with Sigra's restrained default tokens.

Returns the default token map.

Builds a profile and returns {:error, reason} for invalid token values.

Builds a profile and raises on invalid token values.

Converts a profile to a string-keyed map suitable for persistence.

Types

t()

@type t() :: %Sigra.Branding.Profile{
  accent_color: String.t(),
  accent_foreground: String.t(),
  background_color: String.t(),
  border_color: String.t(),
  dark_accent_color: String.t() | nil,
  dark_accent_foreground: String.t() | nil,
  dark_background_color: String.t() | nil,
  dark_border_color: String.t() | nil,
  dark_muted_color: String.t() | nil,
  dark_surface_color: String.t() | nil,
  dark_text_color: String.t() | nil,
  email_from_address: String.t() | nil,
  email_from_name: String.t(),
  email_reply_to: String.t() | nil,
  logo_alt: String.t(),
  logo_url: String.t() | nil,
  muted_color: String.t(),
  privacy_url: String.t() | nil,
  product_name: String.t(),
  support_url: String.t() | nil,
  surface_color: String.t(),
  terms_url: String.t() | nil,
  text_color: String.t(),
  theme: theme_mode()
}

theme_mode()

@type theme_mode() :: :system | :light | :dark

Functions

default(overrides \\ [])

@spec default(keyword() | map()) :: t()

Returns a validated profile with Sigra's restrained default tokens.

defaults()

@spec defaults() :: map()

Returns the default token map.

new(attrs \\ [])

@spec new(keyword() | map()) :: {:ok, t()} | {:error, String.t()}

Builds a profile and returns {:error, reason} for invalid token values.

new!(attrs \\ [])

@spec new!(keyword() | map()) :: t()

Builds a profile and raises on invalid token values.

to_map(profile)

@spec to_map(t()) :: map()

Converts a profile to a string-keyed map suitable for persistence.