diff options
Diffstat (limited to 'layouts/partials/utils/get-style-color.html')
-rw-r--r-- | layouts/partials/utils/get-style-color.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/layouts/partials/utils/get-style-color.html b/layouts/partials/utils/get-style-color.html new file mode 100644 index 0000000..53f71a3 --- /dev/null +++ b/layouts/partials/utils/get-style-color.html @@ -0,0 +1,18 @@ +{{ $style := (index .context.Site.Data.styles (.context.Site.Params.style | default "default")) }} +{{ $result := $style.colors }} +{{ if $result }} + {{ range .path }} + {{ if $result }} + {{ $result = index $result . }} + {{ else }} + {{ errorf "Param %s is undefined in style %s" (delimit $.path ".") $.context.Site.Params.style }} + {{ end }} + {{ end }} + {{ if $result }} + {{ return $result }} + {{ else }} + {{ errorf "Param %s is undefined in style %s" (delimit $.path ".") $.context.Site.Params.style }} + {{ end }} +{{ else }} + {{ errorf "Could not find colors section in style %s." .context.Site.Params.style }} +{{ end }} |