From 0202ab38ac2178e4d78aea1bd15a7a40b3f9de20 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Tue, 11 Jul 2023 22:41:39 +0200 Subject: [PATCH] users: color negative balance red --- plugins/users | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/users b/plugins/users index 2992f66..d1928fc 100644 --- a/plugins/users +++ b/plugins/users @@ -97,7 +97,9 @@ sub _recent($n, $u) { sub balance($self, $u) { _recent(10, $u); call_hooks("user_info", $u); - printf "Balance for $u is \e[1m%s\e[0m\n", RevBank::Users::balance($u)->string("+"); + my $balance = RevBank::Users::balance($u); + my $red = $balance->cents < 0 ? "31;" : ""; + printf "Balance for $u is \e[%s1m%s\e[0m\n", $red, $balance->string("+"); say "NB: Products/amounts/commands FIRST, username LAST."; return ABORT; }