diff --git a/README.md b/README.md index a5f7f0a..f131846 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/). ## Features +- Dark mode (automatic, by switcher) - Pagination - Tags/Categories support - Archive @@ -61,6 +62,7 @@ params: - css/my.css # relative path to "static" directory dateFormat: "2006-01-02" paginationSinglePost: true + style: light-without-switcher markup: goldmark: @@ -78,6 +80,16 @@ Now enter [`localhost:1313`](http://localhost:1313/) in the address bar of your ## Feature Settings +### Dark Mode +Customize via `style` param in `params` section of config. +Options: +- `light-without-switcher` - light theme, without switcher, JS-free (by default) +- `dark-without-switcher` - dark theme, without switcher, JS-free +- `auto-without-switcher` - theme based on user system settings, without switcher, JS-free +- `light` - light theme by default, can be switched by user to dark theme and back. Theme settings are saved for user +- `dark` - dark theme by default, can be switched by user to light theme and back. Theme settings are saved for user +- `auto` - theme based on user system settings by default, can be switched by user to dark/light theme. Theme settings are saved for user + ### Google Analytics Only works for production environment. You either build your site with variable like `HUGO_ENV=production hugo --minify` diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 8ccca3d..817f7a9 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -13,6 +13,9 @@ googleAnalytics = "" [params] author = "Dmitry Kolosov" description = "Anubis is a simple minimalist theme for Hugo blog engine." + dateFormat = "2006-01-02" + paginationSinglePost = true + style = "light-without-switcher" [menu] diff --git a/exampleSiteMultilingual/config.toml b/exampleSiteMultilingual/config.toml index 5d164d6..e33540b 100644 --- a/exampleSiteMultilingual/config.toml +++ b/exampleSiteMultilingual/config.toml @@ -14,6 +14,9 @@ googleAnalytics = "" [params] author = "Dmitry Kolosov" description = "Anubis is a simple minimalist theme for Hugo blog engine." + dateFormat = "2006-01-02" + paginationSinglePost = true + style = "light-without-switcher" [languages.en] languageName = "English" diff --git a/images/screenshot.png b/images/screenshot.png index e344554..4eb5932 100644 Binary files a/images/screenshot.png and b/images/screenshot.png differ diff --git a/images/tn.png b/images/tn.png index 4d652a1..102bd15 100644 Binary files a/images/tn.png and b/images/tn.png differ diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 9f295e8..97bfae4 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,5 +1,9 @@ - +{{ $dataTheme := "" }} +{{ if eq site.Params.style "dark-without-switcher" }} + {{ $dataTheme = "dark" }} +{{ end }} + {{ block "head" . }} {{ partial "head.html" . }} @@ -8,7 +12,7 @@ {{ i18n "skipToContent" | humanize }}
-
+
{{ block "header" . }} {{ partial "header.html" . }} {{ end }} @@ -16,16 +20,9 @@
{{ block "main" . }}{{ end }}
- + {{ block "footer" . }} + {{ partial "footer.html" . }} + {{ end }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index c40d9da..89fec15 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -7,7 +7,7 @@ {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{ range $pages }}
-
+

{{ trim .Title " " }}

{{ partial "postInfo.html" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 6f61195..8d1e3b7 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,7 +8,7 @@ {{ end }}
-
+

{{ trim .Title " " }}

diff --git a/layouts/partials/cssColors.html b/layouts/partials/cssColors.html new file mode 100644 index 0000000..3f64049 --- /dev/null +++ b/layouts/partials/cssColors.html @@ -0,0 +1,18 @@ + diff --git a/layouts/partials/dark.css b/layouts/partials/dark.css new file mode 100644 index 0000000..c7af3c8 --- /dev/null +++ b/layouts/partials/dark.css @@ -0,0 +1,23 @@ +--font-color: #eee; +--bg-color: #212121; + +--link-color:#599ada; +--link-state-color:#ff5858; +--link-state-border-color: rgba(238, 54, 54, 0.5); + +--thead-bg-color: #343a40; +--table-border-color: lightgrey; + +--pre-color: #333; +--pre-bg-color: #f1f1f1; + +--bq-color: #ccc; +--hr-color: #ccc; + +--pagination-bg-color: #373737; +--pagination-link-color: #b6b6b6; + +--post-info-color: grey; + +--switcher-color: #333; +--switcher-bg-color: #fff; diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index a30b076..55dcb24 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,3 +1,14 @@ -

© {{ if isset .Site.Params "author"}}{{ .Site.Params.author }}, {{end}}{{ now.Year }}
-{{ i18n "powered" | humanize }} Hugo, {{ i18n "theme" }} Anubis. -

+
+ {{ $languagesCount := $.Site.Home.AllTranslations }} + {{ if gt $languagesCount 1 }} + {{ partial "languageSelect.html" . }} + {{ end }} + + + + {{ partial "themeSwitcher.html" . }} +
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a799397..b3e1d6d 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -14,6 +14,8 @@ + +{{ partial "cssColors.html" }} {{ range .Site.Params.customCSS -}} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 5b84493..2b29c7e 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,4 +1,4 @@ -

+

{{ .Site.Title }}