legos/background

Types

pub type Direction {
  ToUp
  ToDown
  ToRight
  ToTopRight
  ToBottomRight
  ToLeft
  ToTopLeft
  ToBottomLeft
  ToRad(Float)
  ToDegrees(Int)
}

Constructors

  • ToUp
  • ToDown
  • ToRight
  • ToTopRight
  • ToBottomRight
  • ToLeft
  • ToTopLeft
  • ToBottomLeft
  • ToRad(Float)
  • ToDegrees(Int)
pub type Step {
  ColorStep(ui.Color)
  PercentStep(Int, ui.Color)
  PxStep(Int, ui.Color)
}

Constructors

Values

pub fn color(clr: ui.Color) -> ui.Decoration(decorative, msg)

A background color attribute

pub fn gradient(
  direction: Direction,
  steps: List(Step),
) -> ui.Decoration(decorative, msg)

A linear gradient. First you need to specify what direction the gradient is going by providing an angle in radians. 0.0 is up and pi is down. The colors will be evenly spaced.

pub fn image(src: String) -> ui.Decoration(@internal Aligned, msg)

Resize the image to fit the containing element while maintaining proportions and cropping the overflow.

pub fn percent(pct: Int, color: ui.Color) -> Step

Create a percentage-based color step for gradients

pub fn px(pixels: Int, color: ui.Color) -> Step

Create a pixel-based color step for gradients

pub fn step(color: ui.Color) -> Step

Create a color step for gradients

pub fn tiled(src: String) -> ui.Decoration(@internal Aligned, msg)

Tile an image in the x and y axes.

pub fn tiled_x(
  src: String,
) -> ui.Decoration(@internal Aligned, msg)

Tile an image in the x axis.

pub fn tiled_y(
  src: String,
) -> ui.Decoration(@internal Aligned, msg)

Tile an image in the y axis.

pub fn uncropped(
  src: String,
) -> ui.Decoration(@internal Aligned, msg)

A centered background image that keeps its natural proportions, but scales to fit the space.

✨ Search Document