32 lines
1.1 KiB
HTML
32 lines
1.1 KiB
HTML
{{- $title := .title | default "Placeholder" -}}
|
|
{{- $class := .class -}}
|
|
{{- $default_color := "#6c757d" -}}
|
|
{{- $default_background := "#6c757d" -}}
|
|
{{- $color := .color | default $default_color -}}
|
|
{{- $background := .background | default $default_background -}}
|
|
{{- $width := .width | default "100%" -}}
|
|
{{- $height := .height | default "180" -}}
|
|
{{- $text := .text | default (printf "%sx%s" $width $height) -}}
|
|
{{- $show_title := not (eq $title "false") -}}
|
|
{{- $show_text := not (eq $text "false") -}}
|
|
<svg
|
|
class="{{ with $class }}{{ . }}{{ end }}"
|
|
width="{{ $width }}"
|
|
height="{{ $height }}"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
{{ if (or $show_title $show_text) }}
|
|
role="img"
|
|
aria-label="{{ if $show_title }}
|
|
{{ $title }}{{ if $show_text }}:{{ end }}
|
|
{{ end }}{{ if ($show_text) }}{{ $text }}{{ end }}"
|
|
{{ else }}
|
|
aria-hidden="true"
|
|
{{ end }}
|
|
preserveAspectRatio="xMidYMid slice">
|
|
{{- if $show_title }}<title>{{ $title }}</title>{{ end -}}
|
|
<rect width="100%" height="100%" fill="{{ $background }}" />
|
|
{{- if $show_text }}
|
|
<text x="40%" y="50%" fill="{{ $color }}" dy=".3em">{{ $text }}</text>
|
|
{{ end -}}
|
|
</svg>
|