diff options
Diffstat (limited to 'themes/default/layouts/partials')
-rw-r--r-- | themes/default/layouts/partials/gallery-walk.html | 3 | ||||
-rw-r--r-- | themes/default/layouts/partials/styles-image-gradient.html | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/themes/default/layouts/partials/gallery-walk.html b/themes/default/layouts/partials/gallery-walk.html index 72b587c..c17b0da 100644 --- a/themes/default/layouts/partials/gallery-walk.html +++ b/themes/default/layouts/partials/gallery-walk.html @@ -56,6 +56,9 @@ width="{{ $image.Width }}" height="{{ $image.Height }}" src="{{ $image.RelPermalink }}" + {{ printf `style="` | safeHTMLAttr -}} + {{- partial "styles-image-gradient.html" $image.Colors | safeHTMLAttr -}} + {{- printf `"` | safeHTMLAttr }} /> </picture> </a> diff --git a/themes/default/layouts/partials/styles-image-gradient.html b/themes/default/layouts/partials/styles-image-gradient.html new file mode 100644 index 0000000..794ea8b --- /dev/null +++ b/themes/default/layouts/partials/styles-image-gradient.html @@ -0,0 +1,18 @@ +{{- $colors := . -}} + +{{- with $colors -}} + background: + {{- range $key, $color := $colors -}} + {{- $last := sub (len $colors) 1 -}} + {{- $separator := "," -}} + {{- $color = $color -}} + {{- $position := "top" -}} + {{- if eq $last $key -}} + {{- $separator = ";" -}} + {{- end -}} + {{- if gt $key 0 -}} + {{- $position = "bottom" -}} + {{- end -}} + radial-gradient(ellipse at {{ $position }}, {{ $color }}, transparent){{ $separator }} + {{- end -}} +{{- end -}} |