parse_theme.css 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {{- $scr := .Scratch -}}
  2. {{- $site := $scr.Get "site" -}}
  3. {{/* Attempt to load font style specified by user. */}}
  4. {{- $font_index := .Site.Params.font | default "default" -}}
  5. {{ if isset .Site.Data.fonts $font_index }}
  6. {{- $font := index .Site.Data.fonts $font_index -}}
  7. {{- $scr.Set "google_fonts" $font.google_fonts -}}
  8. {{- $scr.Set "body_font" $font.body_font -}}
  9. {{- $scr.Set "heading_font" $font.heading_font -}}
  10. {{- $scr.Set "nav_font" $font.nav_font -}}
  11. {{- $scr.Set "mono_font" $font.mono_font -}}
  12. {{- $scr.Set "font_size" $font.font_size -}}
  13. {{- $scr.Set "font_size_small" $font.font_size_small -}}
  14. {{ end }}
  15. {{/* Attempt to load color theme specified by user. */}}
  16. {{- $theme_index := .Site.Params.color_theme | default "default" -}}
  17. {{ if isset .Site.Data.themes $theme_index }}
  18. {{ $theme := index .Site.Data.themes $theme_index }}
  19. {{- $scr.Set "light" $theme.light -}}
  20. {{ if $theme.background }}
  21. {{- $scr.Set "background" $theme.background -}}
  22. {{ else if $theme.light }}
  23. {{- $scr.Set "background" "#fff" -}}
  24. {{ else }}
  25. {{- $scr.Set "background" "rgb(40, 42, 54)" -}}
  26. {{ end }}
  27. {{ if $theme.link }}
  28. {{- $scr.Set "link" $theme.link -}}
  29. {{ else }}
  30. {{- $scr.Set "link" $theme.primary -}}
  31. {{ end }}
  32. {{ if $theme.link_hover }}
  33. {{- $scr.Set "link_hover" $theme.link_hover -}}
  34. {{ else }}
  35. {{- $scr.Set "link_hover" $theme.primary -}}
  36. {{ end }}
  37. {{- $scr.Set "primary" $theme.primary -}}
  38. {{- $scr.Set "primary_light" $theme.primary_light -}}
  39. {{- $scr.Set "primary_dark" $theme.primary_dark -}}
  40. {{- $scr.Set "menu_primary" $theme.menu_primary -}}
  41. {{- $scr.Set "menu_text" $theme.menu_text -}}
  42. {{- $scr.Set "menu_text_active" $theme.menu_text_active -}}
  43. {{- $scr.Set "menu_title" $theme.menu_title -}}
  44. {{- $scr.Set "home_section_odd" $theme.home_section_odd -}}
  45. {{- $scr.Set "home_section_even" $theme.home_section_even -}}
  46. {{ end }}