mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 09:43:06 +00:00
258093e2d5
currently only the additional name option is recognized
34 lines
1.3 KiB
CSS
34 lines
1.3 KiB
CSS
{{- $themevariants := partial "get-theme-variants.hugo" . -}}
|
|
{{- $themevariantsauto := slice | append (.Site.Params.themeVariantAuto | default slice) -}}
|
|
{{- $i := 0 -}}
|
|
{{- if eq (int (len $themevariantsauto)) 0 -}}
|
|
{{- range $themevariants -}}
|
|
{{- $i = add $i 1 -}}
|
|
{{- if ne .identifier "auto" -}}
|
|
{{- $themevariantsauto = $themevariantsauto | append .identifier -}}
|
|
{{- break -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- if eq (int (len $themevariantsauto)) 0 -}}
|
|
{{- $themevariantsauto = $themevariantsauto | append "relearn-light" -}}
|
|
{{- end -}}
|
|
{{- if eq (int (len $themevariantsauto)) 1 -}}
|
|
{{- $poppedthemevariants := last (sub (len $themevariants) $i) $themevariants -}}
|
|
{{- range $poppedthemevariants -}}
|
|
{{- if ne .identifier "auto" -}}
|
|
{{- $themevariantsauto = $themevariantsauto | append .identifier -}}
|
|
{{- break -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- if eq (int (len $themevariantsauto)) 1 -}}
|
|
{{- $themevariantsauto = $themevariantsauto | append "relearn-dark" -}}
|
|
{{- end -}}
|
|
{{- $themevariantsauto = ($themevariantsauto | first 2) -}}
|
|
{{- with index $themevariantsauto 0 -}}
|
|
@import "{{ printf "theme-%s.css" . }}" screen and (prefers-color-scheme: light);
|
|
{{ end -}}
|
|
{{- with index $themevariantsauto 1 -}}
|
|
@import "{{ printf "theme-%s.css" . }}" screen and (prefers-color-scheme: dark);
|
|
{{ end -}}
|