|
@@ -1,7 +1,13 @@
|
|
|
{{- $scr := .Scratch -}}
|
|
|
|
|
|
+{{/* Get name of site's Theme. Precedence: Params.toml > Default (Minimal) */}}
|
|
|
{{- $theme_index := (site.Params.theme | lower | replaceRE "\\s" "_") | default "minimal" -}}
|
|
|
-{{- $font_index := (index site.Data.themes $theme_index).font | default (site.Params.font | lower | replaceRE "\\s" "_") | default $theme_index | default "minimal" -}}
|
|
|
+
|
|
|
+{{/* Get name of site's Font Set. Precedence: Params.toml > Theme > Default (Minimal) */}}
|
|
|
+{{- $font_index := (site.Params.font | lower | replaceRE "\\s" "_") | default ((index site.Data.themes $theme_index).font | lower | replaceRE "\\s" "_") | default $theme_index -}}
|
|
|
+{{- $font_index := cond (isset site.Data.fonts $font_index) $font_index "minimal" -}}
|
|
|
+
|
|
|
+{{/* Get Font Size. */}}
|
|
|
|
|
|
{{- $font_size := site.Params.font_size | default "m" -}}
|
|
|
{{- $font_sizes := dict "s" 16 "m" 21 "l" 25 -}}
|
|
@@ -9,50 +15,43 @@
|
|
|
{{- $scr.Set "font_size" $font_size_numeric -}}
|
|
|
{{- $scr.Set "font_size_small" (mul 0.77 $font_size_numeric) -}}
|
|
|
|
|
|
-{{/* Attempt to load font style specified by user. */}}
|
|
|
-{{ if (index site.Data.fonts $font_index) }}
|
|
|
- {{- $font := index site.Data.fonts $font_index -}}
|
|
|
- {{- $scr.Set "google_fonts" $font.google_fonts -}}
|
|
|
- {{- $scr.Set "body_font" $font.body_font -}}
|
|
|
- {{- $scr.Set "heading_font" $font.heading_font -}}
|
|
|
- {{- $scr.Set "nav_font" $font.nav_font -}}
|
|
|
- {{- $scr.Set "mono_font" $font.mono_font -}}
|
|
|
-{{ else }}
|
|
|
- {{ errorf "The `%s` font set was not found! Check that the `font` option in `config/_default/params.toml` matches the name of an installed font set." $font_index }}
|
|
|
-{{ end }}
|
|
|
+{{/* Load Font Set. */}}
|
|
|
+
|
|
|
+{{- $font := index site.Data.fonts $font_index -}}
|
|
|
+{{- $scr.Set "google_fonts" $font.google_fonts -}}
|
|
|
+{{- $scr.Set "body_font" $font.body_font -}}
|
|
|
+{{- $scr.Set "heading_font" $font.heading_font -}}
|
|
|
+{{- $scr.Set "nav_font" $font.nav_font -}}
|
|
|
+{{- $scr.Set "mono_font" $font.mono_font -}}
|
|
|
|
|
|
-{{/* Attempt to load color theme specified by user. */}}
|
|
|
-{{ if (index site.Data.themes $theme_index) }}
|
|
|
- {{ $theme := index site.Data.themes $theme_index }}
|
|
|
-
|
|
|
- {{- $scr.Set "light" ($theme.light | default true) -}}
|
|
|
-
|
|
|
- {{ if $theme.light }}
|
|
|
- {{- $scr.Set "background" ($theme.background | default "#fff") -}}
|
|
|
- {{- $scr.Set "dark_background" "rgb(40, 42, 54)" -}}
|
|
|
- {{- $scr.Set "home_section_odd" $theme.home_section_odd -}}
|
|
|
- {{- $scr.Set "home_section_even" $theme.home_section_even -}}
|
|
|
- {{- $scr.Set "dark_home_section_odd" "hsla(231, 15%, 18%, 1)" -}}
|
|
|
- {{- $scr.Set "dark_home_section_even" "hsla(231, 15%, 16%, 1)" -}}
|
|
|
- {{ else }}
|
|
|
- {{- $scr.Set "background" ($theme.background | default "#fff") -}}
|
|
|
- {{- $scr.Set "dark_background" ($theme.background | default "rgb(40, 42, 54)") -}}
|
|
|
- {{- $scr.Set "home_section_odd" "rgb(255, 255, 255)" -}}
|
|
|
- {{- $scr.Set "home_section_even" "rgb(247, 247, 247)" -}}
|
|
|
- {{- $scr.Set "dark_home_section_odd" $theme.home_section_odd -}}
|
|
|
- {{- $scr.Set "dark_home_section_even" $theme.home_section_even -}}
|
|
|
- {{ end }}
|
|
|
-
|
|
|
- {{- $scr.Set "link" ($theme.link | default $theme.primary) -}}
|
|
|
- {{- $scr.Set "link_hover" ($theme.link_hover | default $theme.primary) -}}
|
|
|
-
|
|
|
- {{- $scr.Set "primary" $theme.primary -}}
|
|
|
-
|
|
|
- {{- $scr.Set "menu_primary" $theme.menu_primary -}}
|
|
|
- {{- $scr.Set "menu_text" $theme.menu_text -}}
|
|
|
- {{- $scr.Set "menu_text_active" $theme.menu_text_active -}}
|
|
|
- {{- $scr.Set "menu_title" $theme.menu_title -}}
|
|
|
+{{/* Load Theme. */}}
|
|
|
|
|
|
+{{ $theme := index site.Data.themes $theme_index }}
|
|
|
+
|
|
|
+{{- $scr.Set "light" ($theme.light | default true) -}}
|
|
|
+
|
|
|
+{{ if $theme.light }}
|
|
|
+ {{- $scr.Set "background" ($theme.background | default "#fff") -}}
|
|
|
+ {{- $scr.Set "dark_background" "rgb(40, 42, 54)" -}}
|
|
|
+ {{- $scr.Set "home_section_odd" $theme.home_section_odd -}}
|
|
|
+ {{- $scr.Set "home_section_even" $theme.home_section_even -}}
|
|
|
+ {{- $scr.Set "dark_home_section_odd" "hsla(231, 15%, 18%, 1)" -}}
|
|
|
+ {{- $scr.Set "dark_home_section_even" "hsla(231, 15%, 16%, 1)" -}}
|
|
|
{{ else }}
|
|
|
- {{ errorf "The `%s` color theme was not found! Check that the `theme` option in `config/_default/params.toml` matches the name of an installed color theme." $theme_index }}
|
|
|
+ {{- $scr.Set "background" ($theme.background | default "#fff") -}}
|
|
|
+ {{- $scr.Set "dark_background" ($theme.background | default "rgb(40, 42, 54)") -}}
|
|
|
+ {{- $scr.Set "home_section_odd" "rgb(255, 255, 255)" -}}
|
|
|
+ {{- $scr.Set "home_section_even" "rgb(247, 247, 247)" -}}
|
|
|
+ {{- $scr.Set "dark_home_section_odd" $theme.home_section_odd -}}
|
|
|
+ {{- $scr.Set "dark_home_section_even" $theme.home_section_even -}}
|
|
|
{{ end }}
|
|
|
+
|
|
|
+{{- $scr.Set "link" ($theme.link | default $theme.primary) -}}
|
|
|
+{{- $scr.Set "link_hover" ($theme.link_hover | default $theme.primary) -}}
|
|
|
+
|
|
|
+{{- $scr.Set "primary" $theme.primary -}}
|
|
|
+
|
|
|
+{{- $scr.Set "menu_primary" $theme.menu_primary -}}
|
|
|
+{{- $scr.Set "menu_text" $theme.menu_text -}}
|
|
|
+{{- $scr.Set "menu_text_active" $theme.menu_text_active -}}
|
|
|
+{{- $scr.Set "menu_title" $theme.menu_title -}}
|