summaryrefslogtreecommitdiff
path: root/status/02-cpu.go
diff options
context:
space:
mode:
authorhhvn <dev@hhvn.uk>2023-11-19 14:50:06 +0000
committerhhvn <dev@hhvn.uk>2023-11-19 14:50:06 +0000
commitf5e80f5bdcf43b7974064168c3eb0d4e993528df (patch)
treeba3a5214c954ff842f6cce64076c4eabcfa9faf2 /status/02-cpu.go
parent4722a069233b35efd0b600c973e7a7e9bca01d16 (diff)
Create function for drawing percentage usage bars
Diffstat (limited to 'status/02-cpu.go')
-rw-r--r--status/02-cpu.go12
1 files changed, 1 insertions, 11 deletions
diff --git a/status/02-cpu.go b/status/02-cpu.go
index 34379fb..e00d74f 100644
--- a/status/02-cpu.go
+++ b/status/02-cpu.go
@@ -5,8 +5,6 @@ import (
"errors"
"strings"
- "hhvn.uk/hbspbar/drw"
- "hhvn.uk/hbspbar/config"
"hhvn.uk/hbspbar/common"
)
@@ -104,15 +102,7 @@ func cpu(name string) error {
ltotal = ltotal - total[i]
used := int((100 * (ltotal - lidle)) / ltotal)
- tbpad := 3
- th := int(config.H) - tbpad * 2 + 1
- h := int(th * used / 100)
- fg := blendGYR(used)
- bg := drw.Blend(fg, config.Status, 75)
-
- u.drawRect(cx, tbpad - 1, 3, th, bg, true)
- u.drawRect(cx, tbpad + th - h - 1, 3, h, fg, true)
- cx += 5
+ cx += u.drawPercentBar(cx, used)
}
temps := 0