etui/widgets/gradient_bar

Types

pub type GradientBar {
  GradientBar(
    fill: GradientFill,
    filled_char: String,
    empty_char: String,
    percent: Int,
    modifier: style.Modifier,
    bg: style.Color,
    period: Int,
  )
}

Constructors

  • GradientBar(
      fill: GradientFill,
      filled_char: String,
      empty_char: String,
      percent: Int,
      modifier: style.Modifier,
      bg: style.Color,
      period: Int,
    )

    Arguments

    percent

    0–100: how much of the bar is filled.

    period

    Animation period in frames.

pub type GradientFill {
  LinearGradient(stops: List(style.Color))
  AnimatedLinear(stops: List(style.Color))
  Rainbow
  AnimatedRainbow
  Pulse(base: style.Color)
}

Constructors

  • LinearGradient(stops: List(style.Color))

    Static left-to-right gradient across color stops.

  • AnimatedLinear(stops: List(style.Color))

    Gradient that scrolls left over time.

  • Rainbow

    Static full-spectrum rainbow.

  • AnimatedRainbow

    Rainbow that rotates hue over time.

  • Pulse(base: style.Color)

    Single color that oscillates between half and full brightness.

Values

pub fn animated_gradient_bar_new(
  stops: List(style.Color),
) -> GradientBar

Animated (scrolling) gradient bar (full width).

pub fn animated_rainbow_bar() -> GradientBar

Animated (rotating) rainbow bar (full width).

pub fn gradient_bar_new(stops: List(style.Color)) -> GradientBar

Static linear gradient bar (full width).

pub fn gradient_progress_new(
  stops: List(style.Color),
  percent: Int,
) -> GradientBar

Gradient progress bar: partial fill, static gradient.

pub fn pulse_bar(base: style.Color) -> GradientBar

Pulsing single-color bar (full width).

pub fn rainbow_bar() -> GradientBar

Static rainbow bar (full width).

pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  g: GradientBar,
  frame: Int,
) -> buffer.Buffer

Render the gradient bar into buf at area. frame drives animation.

pub fn with_chars(
  g: GradientBar,
  filled: String,
  empty: String,
) -> GradientBar
pub fn with_percent(g: GradientBar, pct: Int) -> GradientBar
pub fn with_period(g: GradientBar, period: Int) -> GradientBar
Search Document