diff options
author | bake <bake@192k.pw> | 2019-10-11 16:53:17 +0300 |
---|---|---|
committer | bake <bake@192k.pw> | 2019-10-13 19:47:53 +0300 |
commit | 6663e3ff61fd294b68d826d54815bf1591ac5bb9 (patch) | |
tree | 33d61b6e47fe5dc34d812d308b851e7eafbce641 | |
parent | 1af3484db7f98d358cea4a5fe4b395151824f944 (diff) |
Add preference color scheme description
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | assets/css/colors-dark.scss (renamed from static/css/colors-dark.css) | 2 | ||||
-rw-r--r-- | assets/css/colors-gray.scss (renamed from static/css/colors-gray.css) | 2 | ||||
-rwxr-xr-x | assets/css/colors-light.scss (renamed from static/css/colors-light.css) | 2 | ||||
-rw-r--r-- | assets/css/colors-preference.scss | 6 | ||||
-rwxr-xr-x | assets/css/layout.scss (renamed from static/css/style.css) | 0 | ||||
-rw-r--r-- | exampleSite/config.toml | 4 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 9 |
8 files changed, 21 insertions, 7 deletions
@@ -9,7 +9,8 @@ demo available on ## Color schemes Solar offers three color schemes: (Solarized) `light`, (Solarized) `dark` -(default) and `gray`. +(default) and `gray`. Additionally there is a `preference` setting which +switches between `light` and `dark` according to the users preference. ## Screenshot diff --git a/static/css/colors-dark.css b/assets/css/colors-dark.scss index 967fa51..5dbf563 100755 --- a/static/css/colors-dark.css +++ b/assets/css/colors-dark.scss @@ -1,3 +1,5 @@ +@import 'layout'; + html, body { background-color: #002a35; diff --git a/static/css/colors-gray.css b/assets/css/colors-gray.scss index 4e9ce4f..c5addd8 100644 --- a/static/css/colors-gray.css +++ b/assets/css/colors-gray.scss @@ -1,3 +1,5 @@ +@import 'layout'; + html, body { background-color: #222; diff --git a/static/css/colors-light.css b/assets/css/colors-light.scss index ba1631d..cfd6e77 100755 --- a/static/css/colors-light.css +++ b/assets/css/colors-light.scss @@ -1,3 +1,5 @@ +@import 'layout'; + html, body { background-color: #fdf6e3; diff --git a/assets/css/colors-preference.scss b/assets/css/colors-preference.scss new file mode 100644 index 0000000..84ac023 --- /dev/null +++ b/assets/css/colors-preference.scss @@ -0,0 +1,6 @@ +@media (prefers-color-scheme: dark), (prefers-color-scheme: no-preference) { + @import 'colors-dark'; +} +@media (prefers-color-scheme: light) { + @import 'colors-light'; +} diff --git a/static/css/style.css b/assets/css/layout.scss index 0fab2ea..0fab2ea 100755 --- a/static/css/style.css +++ b/assets/css/layout.scss diff --git a/exampleSite/config.toml b/exampleSite/config.toml index fd8d9e9..894a518 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -5,7 +5,7 @@ pygmentsStyle = "solarized-dark" # solarized-light, -dark or -dark256 copyright = "" [params] - scheme = "dark" # light, dark or gray + scheme = "preference" # light, dark, gray or preference description = "A wizard is never late" [menu] @@ -14,7 +14,7 @@ copyright = "" url = "/index.xml" [[menu.main]] name = "Repository" - url = "https://github.com/bake/solar-theme-hugo" + url = "https://github.com/bake/solar-theme-hugo/" [[menu.other]] name = "Hugo" url = "https://themes.gohugo.io/solar-theme-hugo/" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 1c68074..ffd3274 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -2,15 +2,16 @@ <html> <head> <meta charset="utf-8"> - <title>{{ .Title }}</title> <meta name="viewport" content="width=device-width"> {{ with .OutputFormats.Get "RSS" }} <link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" /> <link href="{{ .RelPermalink }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}" /> {{ end }} - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/hybrid.css"> - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/style.css"> - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/colors-{{ .Site.Params.scheme | default "dark" }}.css"> + + <title>{{ .Title }}</title> + + {{ $style := resources.Get (printf "css/colors-%s.scss" (.Site.Params.scheme | default "dark")) | toCSS | minify | fingerprint }} + <link rel="stylesheet" href="{{ $style.Permalink }}"> {{ partial "head.html" . }} </head> |