diff --git a/themes/patek/assets/css/main.scss b/themes/patek/assets/css/main.scss index 8e04341..ee2952e 100644 --- a/themes/patek/assets/css/main.scss +++ b/themes/patek/assets/css/main.scss @@ -1,6 +1,7 @@ // Bulma customization $primary: #0b2a37; +$link-light: #2EA1FF; // /Bulma customization @@ -116,7 +117,7 @@ a { color: $primary-invert; } a { - color: #73A0E7; + color: $link-light; &:hover { color: white; } @@ -125,7 +126,7 @@ a { a { color: white; &:hover { - color: #73A0E7; + color: $link-light; } } } @@ -185,9 +186,9 @@ h2 a { background-color: $black-ter; color: white; a { - color: $link; + color: $link-light; &:hover { - color: lighten($link, 30) !important; + color: white !important; } } } @@ -200,6 +201,16 @@ h2 a { button svg path { fill: white; } + .pagination-link { + color: white; + &.is-current { + color: black; + background-color: $link-light; + } + } + .has-text-grey { + color: $grey-light !important; + } } #content { diff --git a/themes/patek/assets/js/dark-mode.js b/themes/patek/assets/js/dark-mode.js index 0869cc5..d5c45b0 100644 --- a/themes/patek/assets/js/dark-mode.js +++ b/themes/patek/assets/js/dark-mode.js @@ -1,13 +1,27 @@ -document.addEventListener("DOMContentLoaded", () => { - if (window.location.search.indexOf("darkmode=false") > -1) { - document.cookie = "darkmode=false; path=/"; - if (document.getElementById("content") !== null) { - document.getElementById("content").classList.remove("dark-mode"); - } - } else if (window.location.search.indexOf("darkmode=true") > -1 || document.cookie.indexOf("darkmode=true") > -1) { - document.cookie = "darkmode=true; path=/"; - if (document.getElementById("content") !== null) { - document.getElementById("content").classList.add("dark-mode"); +function restoreDarkmode() { + const elem = document.getElementById("content"); + if (elem && document.cookie.includes("dark-mode=true")) { + elem.classList.add("dark-mode"); + } +} + +function toggleDarkmode() { + const elem = document.getElementById("content"); + if (elem) { + const state = elem.classList.toggle("dark-mode"); + if (state) { + // 31536000 = 1 year; not setting max-age would make it session bound + document.cookie = "dark-mode=true; path=/; max-age=31536000; secure; samesite=strict"; + } else { + // Delete the cookie by immediately expiring it + document.cookie = "dark-mode=; path=/; max-age=0; secure; samesite=strict"; } } +} + +document.addEventListener("DOMContentLoaded", restoreDarkmode); +document.addEventListener("DOMContentLoaded", () => { + for (const toggler of document.getElementsByClassName("dark-mode-toggler")) { + toggler.addEventListener("click", toggleDarkmode); + } }); diff --git a/themes/patek/layouts/partials/menu.html b/themes/patek/layouts/partials/menu.html index 0e9cb6e..e658b50 100644 --- a/themes/patek/layouts/partials/menu.html +++ b/themes/patek/layouts/partials/menu.html @@ -37,6 +37,9 @@ {{ end }}