m3e/theme

theme provides Lustre support for the M3E Theme component

Types

Config holds the configuration for a Theme

pub type Config {
  Config(
    contrast: Contrast,
    density: Int,
    motion: Motion,
    scheme: Scheme,
    strong_focus: Focus,
  )
}

Constructors

Contrast is the contrast level in which to generate a color palette

pub type Contrast {
  High
  Medium
  StandardContrast
}

Constructors

  • High
  • Medium
  • StandardContrast

Density controls layout compactness across density-aware components within a theme

pub type Density =
  Int

Focus defines whether strong focus is enabled

pub type Focus {
  Strong
  Normal
}

Constructors

  • Strong
  • Normal

Motion defines how components animate across the system

pub type Motion {
  Expressive
  Standard
}

Constructors

  • Expressive
  • Standard

Scheme specifies the color scheme

pub type Scheme {
  Auto
  Dark
  Light
}

Constructors

  • Auto
  • Dark
  • Light

Theme is the basis for an m3e-theme component

Fields:

  • color: a HEX color from which to derive color palettes
  • contrast: The contrast level of the theme
  • density: The density of the theme
  • motion: The motion of the theme
  • scheme: The scheme of the theme
  • strong_focus: Whether to enable strong focus indicators
pub opaque type Theme

Values

pub fn color(t: Theme, hex_color: String) -> Theme

color sets the color field

pub fn contrast(t: Theme, contrast: Contrast) -> Theme

contrast sets the contrast field

pub const default_color: String
pub fn default_config() -> Config

default_config creates a new Config with default values

pub const default_contrast: Contrast

Default Contrast

pub const default_density: Int

Default Density

pub const default_focus: Focus
pub const default_motion: Motion

Default Motion

pub const default_scheme: Scheme

Default Scheme

pub fn density(t: Theme, density: Int) -> Theme

density sets the density field

pub fn from_config(config: Config, color: String) -> Theme

from_config constructs a Theme from a Config

pub const largest_density: Int

Largest defined density

pub fn motion(t: Theme, motion: Motion) -> Theme

motion sets the motion field

pub fn new(color: String) -> Theme

new constructs a Theme using default values

pub fn render(
  t: Theme,
  attributes: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)

render creates a Lustre Element from a Theme

Parameters:

  • t: a Theme
  • attributes: a list of additional Attributes
  • children: a list of child Elements
pub fn render_config(
  config: Config,
  color: String,
  attributes: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)

render_config creates a Lustre Element directly from a Config

pub fn scheme(t: Theme, scheme: Scheme) -> Theme

scheme sets the scheme field

pub const smallest_density: Int

Smallest defined density

pub fn strong_focus(t: Theme, strong_focus: Focus) -> Theme

strong_focus sets the strong_focus field

Search Document