etui/widgets/gauge

Types

Horizontal progress bar. percent is clamped to 0–100.

pub type Gauge {
  Gauge(
    percent: Int,
    label: String,
    filled_char: String,
    empty_char: String,
    fg: style.Color,
    bg: style.Color,
    filled_modifier: style.Modifier,
    empty_modifier: style.Modifier,
  )
}

Constructors

Values

pub fn gauge_new(percent: Int) -> Gauge

New gauge at the given percent (clamped to 0–100). Default chars: /.

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

Render the gauge bar into the first row of area.

pub fn with_chars(
  g: Gauge,
  filled: String,
  empty: String,
) -> Gauge

Set filled and empty characters (single-cell graphemes only).

pub fn with_colors(
  g: Gauge,
  fg: style.Color,
  bg: style.Color,
) -> Gauge

Set fg/bg colors for both filled and empty sections.

pub fn with_filled_modifier(
  g: Gauge,
  modifier: style.Modifier,
) -> Gauge

Apply a modifier (bold, etc.) to the filled section only.

pub fn with_label(g: Gauge, label: String) -> Gauge

Set a label overlaid centered on the bar.

pub fn with_style(g: Gauge, s: style.Style) -> Gauge

Apply a style (fg/bg) via a Style value.

Search Document