Add icons on calendar plot

This commit is contained in:
Edgar P. Burkhart 2024-01-03 19:02:08 +01:00
parent 8db2720f75
commit b0716a65b7
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 13 additions and 9 deletions

View file

@ -70,8 +70,8 @@
{% endif %}
{% if m %}
<td class="{% if m.sum > 0 %}p{% else %}m{% endif %}"
style="opacity: {% calendar_opacity m.sum history.max.sum %}"
title="{{ m.sum|pmrvalue }}"></td>
style="background-color: color-mix(in hsl, currentcolor {% calendar_opacity m.sum history.max.sum %}, white)"
title="{{ m.sum|pmrvalue }}">{% up_down_icon m.sum %}</td>
{% else %}
<td></td>
{% endif %}

View file

@ -9,7 +9,7 @@ register = template.Library()
@register.simple_tag
def calendar_opacity(v, vmax):
return f"{math.sin(math.fabs(v/vmax)*math.pi/2):.3f}"
return f"{math.sin(math.fabs(v/vmax)*math.pi/2):.0%}"
@register.simple_tag

View file

@ -89,12 +89,6 @@ table.full-width col.bar {
margin-top: var(--gap);
font-feature-settings: var(--num);
.p {
background: var(--green);
}
.m {
background: var(--red);
}
table {
tbody tr {
background: initial;
@ -104,6 +98,16 @@ table.full-width col.bar {
&:not(:first-child) {
border-top: none;
}
td {
text-align: center;
&.p {
color: var(--green);
}
&.m {
color: var(--red);
}
}
}
}
}