diff --git a/graphics/elements/indicators/hbar.lua b/graphics/elements/indicators/hbar.lua index 4fc8532..4a291ff 100644 --- a/graphics/elements/indicators/hbar.lua +++ b/graphics/elements/indicators/hbar.lua @@ -98,6 +98,7 @@ local function hbar(args) end end + -- change bar color ---@param bar_fg_bg cpair new bar colors function e.recolor(bar_fg_bg) bar_bkg = bar_fg_bg.blit_bkg diff --git a/graphics/elements/indicators/vbar.lua b/graphics/elements/indicators/vbar.lua index 7888033..38eb023 100644 --- a/graphics/elements/indicators/vbar.lua +++ b/graphics/elements/indicators/vbar.lua @@ -80,6 +80,17 @@ local function vbar(args) end end + -- change bar color + ---@param fg_bg cpair new bar colors + function e.recolor(fg_bg) + fgd = util.strrep(fg_bg.blit_fgd, e.frame.w) + bkg = util.strrep(fg_bg.blit_bkg, e.frame.w) + + -- re-draw + last_num_bars = 0 + e.on_update(e.value) + end + function e.set_value(val) e.on_update(val) end return e.get()