Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nanxiaobei/hugo-paper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanxiaobei <nanxiaobei@gmail.com>2022-08-21 08:57:54 +0300
committernanxiaobei <nanxiaobei@gmail.com>2022-08-21 08:57:54 +0300
commit115284347f28d92e7d7187857e58d81ee2aa0ff5 (patch)
treed7cc5dabd6b75e826fa94b9ba7ea728847b2f585
parent1d39ed7d733e22f812a9c290385123ebc133cab0 (diff)
update default bg color
-rwxr-xr-xREADME.md4
-rw-r--r--exampleSite/config.toml2
-rw-r--r--layouts/_default/baseof.html10
-rw-r--r--layouts/partials/header.html4
4 files changed, 10 insertions, 10 deletions
diff --git a/README.md b/README.md
index e4a54a7..b3e1ddf 100755
--- a/README.md
+++ b/README.md
@@ -49,8 +49,8 @@ Available options to `config.toml`:
disqusShortname = 'YOUR_DISQUS_SHORTNAME' # add disqus comments
[params]
- # color theme
- theme = 'gray' # gray, light, linen, wheat
+ # color style
+ color = 'linen' # linen, wheat, gray, light
# header social icons
twitter = 'YOUR_TWITTER_ID' # twitter.com/YOUR_TWITTER_ID
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 997443f..77e80bd 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -15,7 +15,7 @@ theme = "hugo-paper"
title = "Paper"
[params]
- theme = 'linen'
+ color = 'linen'
twitter = 'nanxiaobei'
github = 'nanxiaobei'
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 63182d4..14f63a6 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,12 +1,12 @@
<!DOCTYPE html>
-{{ $.Scratch.Delete "theme_color" }}<!---->
+{{ $.Scratch.Delete "bg_color" }}<!---->
{{ $.Scratch.Delete "social_list" }}<!---->
{{ $.Scratch.Delete "avatar_url" }}<!---->
-<!-- theme_color -->
-{{ $theme_map := dict "gray" "#fbfbfb" "light" "#fff" "linen" "#faf6f1" "wheat" "#f1efe1" }}<!---->
-{{ $.Scratch.Set "theme_color" (index $theme_map (site.Params.theme | default (print "gray"))) }}<!---->
+<!-- bg_color -->
+{{ $color_map := dict "linen" "#faf6f1" "wheat" "#f1efe1" "gray" "#fbfbfb" "light" "#fff" }}<!---->
+{{ $.Scratch.Set "bg_color" (index $color_map (site.Params.color | default (print "linen"))) }}<!---->
<!-- social_list -->
{{ $social_params := slice "twitter" "github" "instagram" "rss" }}<!---->
@@ -29,7 +29,7 @@
<html
class="not-ready text-sm lg:text-base"
- style="--bg: {{ $.Scratch.Get `theme_color` }}"
+ style="--bg: {{ $.Scratch.Get `bg_color` }}"
lang="{{ site.LanguageCode }}"
>
{{ partial "head.html" . }}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 73fdc1e..32c5638 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -12,7 +12,7 @@
class="btn-menu relative z-50 -mr-8 flex h-[5rem] w-[5rem] shrink-0 cursor-pointer flex-col items-center justify-center gap-2.5 lg:hidden"
></a>
- {{ $theme_color := $.Scratch.Get "theme_color" }}
+ {{ $bg_color := $.Scratch.Get "bg_color" }}
<script>
// base
const htmlClass = document.documentElement.classList;
@@ -28,7 +28,7 @@
// dark theme
const metaTheme = document.querySelector('meta[name="theme-color"]');
- const lightBg = `{{ $.Scratch.Get "theme_color" }}`.replace(/"/g, '');
+ const lightBg = `{{ $.Scratch.Get "bg_color" }}`.replace(/"/g, '');
const setDark = (isDark) => {
metaTheme.setAttribute('content', isDark ? '#000' : lightBg);
htmlClass[isDark ? 'add' : 'remove']('dark');