Commit 2eca9cdd authored by Laura Kalbag's avatar Laura Kalbag
Browse files

Rename favicon folders to correspond with colour config names

Also remove now-outdated .png favicon icons
parent 0cd52cb2
{{- /* get chosen colour */ -}}
{{- $colour := $.Site.Params.colour }}
{{/* generate a web manifest based on theme colours */}}
{{- /* set favicon colour to storm-blue by default*/ -}}
{{- $faviconFolder := "stormBlue"}}
{{- $themeColour := .Site.Data.themeColoursStormBlue.colour80 }}
{{- /* get the theme colour */ -}}
{{ $colourTheme := partial "get-param/colour-theme.html" . }}
{{- /* get the theme colour’s corresponding data file so we can use its values */ -}}
{{ $colourFile := index site.Data.colourThemes.themes $colourTheme }}
{{- /* get the theme colours’s theme colour from the colour file */ -}}
{{ $themeColour := $colourFile.themeDarkmode }}
{{- /* get the correct favicons from the corresponding folder to the colour theme */ -}}
{{- $androidChrome192 := printf "/favicons/%v/android-chrome-192x192.png" $colourTheme -}}
{{- $androidChrome512 := printf "/favicons/%v/android-chrome-512x512.png" $colourTheme -}}
{{- /* replace the favicon colour from the colour data file if the chosen colour is not storm-blue */ -}}
{{- if eq $colour "amber-orange" }}
{{- $faviconFolder = "amberOrange"}}
{{- $themeColour = .Site.Data.themeColoursAmberOrange.colour80 }}
{{- else if eq $colour "ash-beige" }}
{{- $faviconFolder = "ashBeige"}}
{{- $themeColour = .Site.Data.themeColoursAshBeige.colour80 }}
{{- else if eq $colour "lavender-blue" }}
{{- $faviconFolder = "lavenderBlue"}}
{{- $themeColour = .Site.Data.themeColoursLavenderBlue.colour80 }}
{{- else if eq $colour "lilac-pink" }}
{{- $faviconFolder = "lilacPink"}}
{{- $themeColour = .Site.Data.themeColoursLilacPink.colour80 }}
{{- else if eq $colour "lime-green" }}
{{- $faviconFolder = "limeGreen"}}
{{- $themeColour = .Site.Data.themeColoursLimeGreen.colour80 }}
{{- else if eq $colour "mustard-yellow" }}
{{- $faviconFolder = "mustardYellow"}}
{{- $themeColour = .Site.Data.themeColoursMustardYellow.colour80 }}
{{- else if eq $colour "olive-green" }}
{{- $faviconFolder = "oliveGreen"}}
{{- $themeColour = .Site.Data.themeColoursOliveGreen.colour80 }}
{{- else if eq $colour "plum-pink" }}
{{- $faviconFolder = "plumPink"}}
{{- $themeColour = .Site.Data.themeColoursPlumPink.colour80 }}
{{- else if eq $colour "sea-blue" }}
{{- $faviconFolder = "seaBlue"}}
{{- $themeColour = .Site.Data.themeColoursSeaBlue.colour80 }}
{{- else if eq $colour "steel-grey" }}
{{- $faviconFolder = "steelGrey"}}
{{- $themeColour = .Site.Data.themeColoursSteelGrey.colour80 }}
{{- end -}}
{{- $androidChrome192 := printf "/favicons/%v/android-chrome-192x192.png" $faviconFolder -}}
{{- $androidChrome512 := printf "/favicons/%v/android-chrome-512x512.png" $faviconFolder -}}
{
"name": "{{ .Site.Title }}",
"short_name": "{{ .Site.Title }}",
......
......@@ -5,7 +5,6 @@
{{- $coloursCSS := resources.Get "css/colours.css" }}
{{- $colours := $coloursCSS | resources.ExecuteAsTemplate "colours.css" . }}
{{- /* get the variables to fit the colour mode options */}}
{{- $coloursMode := resources.Get "css/colour-modes.css" }}
......
......@@ -2,21 +2,29 @@
{{- /* if they don’t, use a colour themed default icon */ -}}
{{- /* get the theme colour */ -}}
{{ $colourTheme := partial "get-param/colour-theme.html" . }}
{{- /* get the theme colour’s corresponding data file so we can use its values */ -}}
{{ $colourFile := index site.Data.colourThemes.themes $colourTheme }}
{{- /* get the theme colours’s theme lightmode colour from the colour file */ -}}
{{ $themeLightmode := $colourFile.themeLightmode }}
{{- /* get the theme colours’s theme darkmode colour from the colour file */ -}}
{{ $themeDarkmode := $colourFile.themeDarkmode }}
<meta name='theme-color' content='{{ $colourFile }}'>
<meta name='theme-color' content='{{ $themeLightmode }}'>
<meta name="theme-color" media="(prefers-color-scheme: light)" content="{{ $themeLightmode }}">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="{{ $themeDarkmode }}">
{{- /* basic favicons, prioritising those advised in
https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs */ -}}
{{- /* get the theme colour’s corresponding favicon folder */ -}}
{{ $faviconFolder := $colourTheme }}
{{- /* pull in web manifest file */ -}}
{{- $webmanifest := resources.Get "favicons/site.webmanifest" }}
{{- $webmanifestFile := $webmanifest | resources.ExecuteAsTemplate "site.webmanifest" . }}
<link rel='manifest' href='{{ $webmanifestFile.RelPermalink }}'>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment