From ae82675a60c89a04519e28a54c1a80d8840616be Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 6 Apr 2014 21:18:36 +0200 Subject: [PATCH] brmbar-web: Color rows by balance --- brmbar3/brmbar-web.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/brmbar3/brmbar-web.py b/brmbar3/brmbar-web.py index dd54a5e..11e496c 100755 --- a/brmbar3/brmbar-web.py +++ b/brmbar3/brmbar-web.py @@ -16,7 +16,13 @@ def stock(): # FIXME: XSS protection. response = '' for a in shop.account_list("inventory"): - response += '' % (a.id, a.name, a.balance()) + style = '' + balance = a.balance() + if balance == 0: + style = 'color: grey; font-style: italic' + elif balance < 0: + style = 'color: red' + response += '' % (style, a.id, a.name, balance) response += '
IdItem NameBal.
%d%s%d
%d%s%d
' return response