{{- $name := .name | default . -}}
{{- $class := .class -}}
{{- $label := .label -}}
{{- $color := .color -}}
{{- $path := printf "icons/%s.svg" $name -}}
{{- with resources.Get $path -}}
<span class="icon icon-{{ $name }}{{ with $class }} {{ . }}{{ end }}"{{ with $color }} style="--icon-color: var(--{{ . }});"{{ end }}{{ if $label }} role="img" aria-label="{{ $label }}"{{ else }} aria-hidden="true"{{ end }}>
    {{ .Content | safeHTML }}
</span>
{{- else -}}
{{- errorf "Icon not found: %s" $path -}}
{{- end -}}