etui/widgets/hbar

Types

pub type HBar {
  HBar(
    items: List(HBarItem),
    max_val: Int,
    fill: HBarFill,
    label_width: Int,
    show_value: Bool,
    bar_char: String,
    empty_char: String,
    bg: style.Color,
    period: Int,
  )
}

Constructors

  • HBar(
      items: List(HBarItem),
      max_val: Int,
      fill: HBarFill,
      label_width: Int,
      show_value: Bool,
      bar_char: String,
      empty_char: String,
      bg: style.Color,
      period: Int,
    )

    Arguments

    max_val

    0 = auto-compute max from data.

    label_width

    Width reserved for labels. 0 = auto (longest label).

    show_value

    Whether to append the numeric value after the bar.

pub type HBarFill {
  HBarSolid(colors: List(style.Color))
  HBarGradient(stops: List(style.Color))
  HBarRainbow
  HBarAnimatedRainbow
}

Constructors

  • HBarSolid(colors: List(style.Color))

    Cycle through a list of solid colors, one per bar.

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

    Static left-to-right gradient applied to each bar’s filled cells.

  • HBarRainbow

    Each bar gets a different hue; static rainbow.

  • HBarAnimatedRainbow

    Rainbow that rotates hue over time.

pub type HBarItem {
  HBarItem(label: String, value: Int)
}

Constructors

  • HBarItem(label: String, value: Int)

Values

pub fn hbar_new(items: List(HBarItem)) -> HBar
pub fn item(label: String, value: Int) -> HBarItem
pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  h: HBar,
  frame: Int,
) -> buffer.Buffer
pub fn with_bg(h: HBar, bg: style.Color) -> HBar
pub fn with_chars(h: HBar, bar: String, empty: String) -> HBar
pub fn with_fill(h: HBar, fill: HBarFill) -> HBar
pub fn with_label_width(h: HBar, w: Int) -> HBar
pub fn with_max(h: HBar, max: Int) -> HBar
pub fn with_period(h: HBar, period: Int) -> HBar
pub fn with_show_value(h: HBar, show: Bool) -> HBar
pub fn with_style(h: HBar, s: style.Style) -> HBar
Search Document