From f933e10cd308263abd5dce970958ac340ae9e847 Mon Sep 17 00:00:00 2001 From: zzossig Date: Tue, 18 Feb 2020 22:11:46 +0900 Subject: [PATCH] meta color added --- layouts/partials/head/meta.html | 8 ++++---- layouts/partials/head/scripts.html | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index b7fb68c..48b4927 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -27,13 +27,13 @@ {{ end }} {{ hugo.Generator }} - + - + - + - + {{ if $.Site.Params.useFaviconGenerator }} diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html index 1e81e67..bb8de1a 100644 --- a/layouts/partials/head/scripts.html +++ b/layouts/partials/head/scripts.html @@ -438,6 +438,25 @@ var selectThemeElem = document.querySelectorAll('.select-theme'); var selectThemeItemElem = document.querySelectorAll('.select-theme__item'); + var setMetaColor = function(themeColor) { + if (themeColor.includes('dark')) { + {{ $.Scratch.Set "themeTitleColor" "#fcfcfa" }} + {{ $.Scratch.Set "themeNavbarColor" "#403E41" }} + } else if (themeColor.includes('light')) { + {{ $.Scratch.Set "themeTitleColor" "#555" }} + {{ $.Scratch.Set "themeNavbarColor" "#eee" }} + } else if (themeColor.includes('hacker')) { + {{ $.Scratch.Set "themeTitleColor" "#e3cd26" }} + {{ $.Scratch.Set "themeNavbarColor" "#252526" }} + } else if (themeColor.includes('solarized')) { + {{ $.Scratch.Set "themeTitleColor" "#586e75" }} + {{ $.Scratch.Set "themeNavbarColor" "#eee8d5" }} + } else if (themeColor.includes('kimbie')) { + {{ $.Scratch.Set "themeTitleColor" "#d3af86" }} + {{ $.Scratch.Set "themeNavbarColor" "#51412c" }} + } + } + if (localTheme) { selectThemeItemElem ? selectThemeItemElem.forEach(function (elem) { @@ -447,6 +466,9 @@ elem.classList.remove('is-active'); } }) : null; + setMetaColor(localTheme); + } else { + setMetaColor(rootEleme.className); } selectThemeItemElem ?