{{- $tempthemevariants := slice | append (.Site.Params.themeVariant | default "auto" ) }} {{- $themevariants := slice }} {{- range $tempthemevariant := $tempthemevariants }} {{- $themevariant := $tempthemevariant }} {{- if not (reflect.IsMap $themevariant) }} {{- $themevariant = dict "identifier" $tempthemevariant }} {{- end }} {{- if not $themevariant.name }} {{- $themevariant = collections.Merge $themevariant (dict "name" ($themevariant.identifier | humanize | strings.Title)) }} {{- end }} {{- if eq $themevariant.identifier "auto" }} {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | default slice)) }} {{- end }} {{- $themevariants = $themevariants | append $themevariant }} {{- end }} {{- $tempthemevariants = $themevariants }} {{- $themevariants = slice }} {{- range $tempthemevariant := $tempthemevariants }} {{- $themevariant := $tempthemevariant }} {{- if collections.IsSet $themevariant "auto" }} {{- $i := 0 }} {{- if eq (int (len $themevariant.auto)) 0 }} {{- range $tempthemevariants }} {{- $i = add $i 1 }} {{- if not (collections.IsSet . "auto") }} {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | append .identifier)) }} {{- break }} {{- end }} {{- end }} {{- end }} {{- if eq (int (len $themevariant.auto)) 0 }} {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | append "relearn-light")) }} {{- end }} {{- if eq (int (len $themevariant.auto)) 1 }} {{- $poppedthemevariants := last (sub (len $tempthemevariants) $i) $tempthemevariants }} {{- range $poppedthemevariants }} {{- if not (collections.IsSet . "auto") }} {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | append .identifier)) }} {{- break }} {{- end }} {{- end }} {{- end }} {{- if eq (int (len $themevariant.auto)) 1 }} {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | append "relearn-dark")) }} {{- end }} {{- $themevariant = collections.Merge $themevariant (dict "auto" ($themevariant.auto | first 2)) }} {{- end }} {{- $themevariants = $themevariants | append $themevariant }} {{- end }} {{- return $themevariants }}