etui/widgets/line_gauge

Types

Line gauge configuration.

pub type LineGauge {
  LineGauge(
    percent: Int,
    label: String,
    line_set: LineSet,
    fg: style.Color,
    bg: style.Color,
    filled_modifier: style.Modifier,
    unfilled_modifier: style.Modifier,
  )
}

Constructors

  • LineGauge(
      percent: Int,
      label: String,
      line_set: LineSet,
      fg: style.Color,
      bg: style.Color,
      filled_modifier: style.Modifier,
      unfilled_modifier: style.Modifier,
    )

    Arguments

    percent

    Progress ratio 0–100 (clamped).

    label

    Optional text overlaid in the center.

    line_set

    Line character set.

    fg

    Foreground color (filled portion and label).

    bg

    Background color (unfilled portion).

    filled_modifier

    Modifier applied to the filled portion.

    unfilled_modifier

    Modifier applied to the unfilled portion.

Character set for the gauge line.

pub type LineSet {
  ThinLine
  DoubleLine
  ThickLine
  BrailleLine
  AsciiLine
}

Constructors

  • ThinLine

    Thin Unicode line (─ ╴ ╶)

  • DoubleLine

    Double Unicode line (═ ╸ ╺)

  • ThickLine

    Thick line (━ ╸ ╺)

  • BrailleLine

    Braille dots (⣿ ⣀)

  • AsciiLine

    ASCII fallback (= -)

Values

pub fn line_gauge_new(percent: Int) -> LineGauge

New line gauge at the given percent (clamped to 0–100).

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

Render the line gauge into the first row of area.

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

Set foreground and background colors.

pub fn with_filled_modifier(
  g: LineGauge,
  m: style.Modifier,
) -> LineGauge

Apply a modifier to the filled portion.

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

Set a label shown in the center of the gauge.

pub fn with_line_set(g: LineGauge, ls: LineSet) -> LineGauge

Set the line character set.

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

Set fg/bg from a Style value.

Search Document