Vary health and mana bar color according to percentage remaining

This commit is contained in:
Gabriel Augendre 2022-11-09 21:01:36 +01:00
parent 71ce3eefa0
commit 6abf6bec8b
2 changed files with 2 additions and 2 deletions

View file

@ -5,7 +5,7 @@
hx-trigger="refresh_health_bar from:body"
hx-swap="outerHTML"
{% endif %}>
<div class="progress-bar bg-success" style="width: {{ character.health_remaining_percent|floatformat:"0" }}%">
<div class="progress-bar {% if character.health_remaining_percent > 60 %}bg-success{% elif character.health_remaining_percent > 30 %}bg-warning{% else %}bg-danger{% endif %}" style="width: {{ character.health_remaining_percent|floatformat:"0" }}%">
PV : {{ character.health_remaining }}/{{ character.health_max }}
</div>
</div>

View file

@ -5,7 +5,7 @@
hx-trigger="refresh_mana_bar from:body"
hx-swap="outerHTML"
{% endif %}>
<div class="progress-bar bg-primary" style="width: {{ character.mana_remaining_percent|floatformat:"0" }}%">
<div class="progress-bar {% if character.mana_remaining_percent > 60 %}bg-primary{% elif character.mana_remaining_percent > 30 %}bg-warning{% else %}bg-danger{% endif %}" style="width: {{ character.mana_remaining_percent|floatformat:"0" }}%">
PM : {{ character.mana_remaining }}/{{ character.mana_max }}
</div>
</div>