From 07c353258f2d08a57017e7aa2ac1ebdd06472dec Mon Sep 17 00:00:00 2001 From: brooke Date: Tue, 18 Jun 2024 19:04:31 -0400 Subject: [PATCH] add theme support --- assets/css/blue.css | 11 +++++++++++ assets/css/purple.css | 11 +++++++++++ assets/css/red.css | 11 +++++++++++ exampleSite/hugo.yaml | 2 ++ layouts/partials/head/css.html | 33 ++++++++++++++++++++++----------- 5 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 assets/css/blue.css create mode 100644 assets/css/purple.css create mode 100644 assets/css/red.css diff --git a/assets/css/blue.css b/assets/css/blue.css new file mode 100644 index 0000000..8c347c9 --- /dev/null +++ b/assets/css/blue.css @@ -0,0 +1,11 @@ +.highlight { + color: #4286f4 !important; +} + +.curly { + color: #8d00c5 !important; +} + +.square { + color: #66ffed !important; +} diff --git a/assets/css/purple.css b/assets/css/purple.css new file mode 100644 index 0000000..43943e8 --- /dev/null +++ b/assets/css/purple.css @@ -0,0 +1,11 @@ +.highlight { + color: #9966cc !important; +} + +.curly { + color: #993374 !important; +} + +.square { + color: #c77b7b !important; +} diff --git a/assets/css/red.css b/assets/css/red.css new file mode 100644 index 0000000..12f40c5 --- /dev/null +++ b/assets/css/red.css @@ -0,0 +1,11 @@ +.highlight { + color: #e83e3e !important; +} + +.curly { + color: #ef7373 !important; +} + +.square { + color: #ffb0b0 !important; +} diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index 586c0a8..c2134ac 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -24,6 +24,8 @@ params: asciiArt: 2 + theme: default + disableKinds: - taxonomy ignoreErrors: diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html index 36cbbb4..4755e26 100644 --- a/layouts/partials/head/css.html +++ b/layouts/partials/head/css.html @@ -1,11 +1,22 @@ -{{- with resources.Get "css/main.css" }} {{- if eq hugo.Environment -"development" }} - -{{- else }} {{- with . | minify | fingerprint }} - -{{- end }} {{- end }} {{- end }} +{{- with resources.Get "css/main.css" }} + {{- if eq hugo.Environment "development" }} + + {{- else }} + {{- with . | minify | fingerprint }} + + {{- end }} + {{- end }} +{{- end }} + +{{- $theme := .Site.Params.theme }} +{{- if and $theme (ne $theme "default") }} + {{- with resources.Get (printf "css/%s.css" $theme) }} + {{- if eq hugo.Environment "development" }} + + {{- else }} + {{- with . | minify | fingerprint }} + + {{- end }} + {{- end }} + {{- end }} +{{- end }} \ No newline at end of file