From df7bd3df0a47e3929e0756077ff1f3e2baa0233c Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Mon, 24 Aug 2026 21:54:12 +0200 Subject: [PATCH] add SignalBars Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- app/components.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/components.go b/app/components.go index e702cb1..f175ddd 100644 --- a/app/components.go +++ b/app/components.go @@ -2,6 +2,7 @@ package app import ( "image/color" + "strings" "charm.land/lipgloss/v2" "github.com/anotherhadi/ilovetui/style" @@ -37,3 +38,18 @@ func RenderBadge(label string, fill color.Color) string { cap := lipgloss.NewStyle().Foreground(fill).Background(style.S.Background) return cap.Render("") + body + cap.Render("") } + +func SignalBars(signal int) string { + bars := []rune("▁▃▅▇") + level := signal * len(bars) / 100 + + var b strings.Builder + for i, ch := range bars { + s := lipgloss.NewStyle().Foreground(style.S.Subtle) + if i < level { + s = lipgloss.NewStyle().Foreground(style.S.Text) + } + b.WriteString(s.Render(string(ch))) + } + return b.String() +}