701 B · text History 2264215
{# Avatar: uploaded image if present, else a themed letter avatar whose color
   (a DaisyUI semantic color) is deterministic per name and matches the active
   theme. `has_avatar` is truthy when the user has uploaded an image. #}
{% macro avatar(id, name, has_avatar, size="size-8", textsize="text-sm") %}
{%- if has_avatar -%}
<img src="/u/{{ id }}/avatar" alt="" class="{{ size }} rounded-full bg-base-300 object-cover shrink-0" loading="lazy"/>
{%- else -%}
{%- set c = avatar_color(name) -%}
<span class="{{ size }} {{ textsize }} rounded-full inline-flex items-center justify-center font-bold uppercase shrink-0 bg-{{ c }} text-{{ c }}-content">{{ name[:1] }}</span>
{%- endif -%}
{% endmacro %}