From 984c0e16d67d75ab498d0008daf4eced2756eebd Mon Sep 17 00:00:00 2001 From: Greenscreener Date: Tue, 16 Jul 2019 15:22:58 +0200 Subject: [PATCH] Added darkmode, but it is not persistent yet. --- themes/patek/assets/css/main.scss | 7 +++++++ themes/patek/assets/js/darkMode.js | 5 +++++ themes/patek/layouts/_default/baseof.html | 1 + 3 files changed, 13 insertions(+) create mode 100644 themes/patek/assets/js/darkMode.js diff --git a/themes/patek/assets/css/main.scss b/themes/patek/assets/css/main.scss index 328b953..afe09df 100644 --- a/themes/patek/assets/css/main.scss +++ b/themes/patek/assets/css/main.scss @@ -100,4 +100,11 @@ h2 a { margin-right: 0.3em; color: $link; } +.dark-mode, .dark-mode * { + background-color: $black-ter !important; + color: white !important; + a { + color: $link !important; + } +} // /Custom styles \ No newline at end of file diff --git a/themes/patek/assets/js/darkMode.js b/themes/patek/assets/js/darkMode.js new file mode 100644 index 0000000..4ea4202 --- /dev/null +++ b/themes/patek/assets/js/darkMode.js @@ -0,0 +1,5 @@ +document.addEventListener("DOMContentLoaded", () => { + if (window.location.search.indexOf("darkmode=true") > -1) { + document.getElementById("content").classList.add("dark-mode"); + } +}); \ No newline at end of file diff --git a/themes/patek/layouts/_default/baseof.html b/themes/patek/layouts/_default/baseof.html index 4ba6a78..fa71559 100644 --- a/themes/patek/layouts/_default/baseof.html +++ b/themes/patek/layouts/_default/baseof.html @@ -13,6 +13,7 @@ {{ block "js" . -}} {{ partial "js.html" "js/headerLink.js" }} {{ partial "js.html" "js/patek-logo-custom-element/patekLogo.js" }} + {{ partial "js.html" "js/darkMode.js" }} {{ end }} {{ block "body" . }}