Cybrkyd's Git Repositories

python-budget - commit: b5d208d

commit b5d208d38ae002adc35dba245262c2b8885e1cc232cf4659f5bd3e132f70db3b
author Cybrkyd <git@cybrkyd.com> 2026-06-04 09:18:14 +0100
committer Cybrkyd <git@cybrkyd.com> 2026-06-04 09:18:14 +0100

Commit Message

JavaScript green/red colour on positive/negative amounts

📊 Diffstat

budget.py 9
1 files changed, 9 insertions(+), 0 deletions(-)

Diff

diff --git a/budget.py b/budget.py
index 6837337..6d5366d 100644
--- a/budget.py
+++ b/budget.py
@@ -174,6 +174,15 @@ HTML = """
</div>
</div>
</div>
+
+ <script>
+ document.querySelectorAll('.amount').forEach(el => {{
+ let rawText = el.innerText;
+ let value = parseFloat(rawText.replace(/,/g, ''));
+ el.style.color = value >= 0 ? 'green' : 'red';
+ }});
+ </script>
+
</body>
</html>
"""