wip: color resource rates red when draining, green when gaining, dim at zero
Some checks failed
Accessibility Checks / a11y-audit (pull_request) Failing after 2s
Smoke Test / smoke (pull_request) Failing after 4s

This commit is contained in:
Alexander Whitestone
2026-04-11 18:25:58 -04:00
parent b6aa172a25
commit 2e54af511f

10
game.js
View File

@@ -1849,11 +1849,17 @@ function renderResources() {
const el = document.getElementById(id);
if (el) {
el.textContent = fmt(val);
// Show full spelled-out number on hover for educational value
// Show full spelled-out number on hover for educational reference
el.title = val >= 1000 ? spellf(Math.floor(val)) : '';
}
const rEl = document.getElementById(id + '-rate');
if (rEl) rEl.textContent = (rate >= 0 ? '+' : '') + fmt(rate) + '/s';
if (rEl) {
rEl.textContent = (rate >= 0 ? '+' : '') + fmt(rate) + '/s';
// Red when draining, green when gaining, dim when zero
if (rate < 0) rEl.style.color = '#f44336';
else if (rate > 0) rEl.style.color = '#4caf50';
else rEl.style.color = '#555';
}
};
set('r-code', G.code, G.codeRate);