Commit 10a23d6f authored by Laura Kalbag's avatar Laura Kalbag
Browse files

Compile colour themes from data/colourThemes as CSS variables

in colours.css
It works! Towards #164
parent 44bad37e
{{- /* COLOURS, concatenated as 1/14 file in the stylesheet */ -}}
{{- /* loads in the colour palettes from data/colourThemes as CSS variables */ -}}
{{- /* load in colour palette that’s applicable to "all" */ -}}
{{- $coloursAll := .Site.Data.colourThemes.coloursAll.json }}
......@@ -16,19 +18,17 @@
{{- /* all other available colour palettes */ -}}
{{- /* get all available colour palettes */ -}}
{{- $coloursBlue := .Site.Data.colourThemes.themes.coloursBlue.json }}
{{- /* range through all colour palettes */ -}}
{{ range $themeColour, $map := .Site.Data.colourThemes.themes -}}
{{- /* set the data-colour-theme selector using the colour name as the value */ -}}
[data-colour-theme="{{ .Site.Data.colourThemes.themes.coloursBlue.themeColourName }}"] {
{{- /* range through all the key value pairs in the colour palette json file */ -}}
{{ range $variable, $value := .Site.Data.colourThemes.themes.coloursBlue }}
{{- /* convert the key variable from camelCase into -separated */ -}}
{{ $variable = replaceRE "([a-z])([A-Z])" "$1-$2" $variable }}
{{- /* make the variable lowercase */ -}}
--{{ lower $variable }}: {{ $value }};
{{ end }}
}
\ No newline at end of file
[data-colour-theme="{{ index $map "themeColourName" }}"] {
{{- /* range through all the key value pairs in the colour palette json file */ -}}
{{ range $variable, $value := $map }}
{{- /* convert the key variable from camelCase into -separated */ -}}
{{ $variable = replaceRE "([a-z])([A-Z])" "$1-$2" $variable }}
{{- /* make the variable lowercase */ -}}
--{{ lower $variable }}: {{ $value }};
{{ end }}
}
{{ end }}
\ 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