From f6e43bfdbda93278b44ee81718c58aa82d57da9c Mon Sep 17 00:00:00 2001 From: Cheslav Zhuravsky Date: Wed, 11 Sep 2024 12:37:01 +0700 Subject: [PATCH 1/5] fix theme --- logseq/custom.css | 33 ++++++++++----------------------- logseq/custom.css.map | 1 + logseq/custom.scss | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 logseq/custom.css.map create mode 100644 logseq/custom.scss diff --git a/logseq/custom.css b/logseq/custom.css index 1357e90..25ce8c6 100644 --- a/logseq/custom.css +++ b/logseq/custom.css @@ -1,33 +1,20 @@ -.dark { +html[data-theme=dark] { --ls-main-content-background: black; - /* --rx-green-09: #30a46c; */ /* --rx-green-10: #3cb179; */ /* --rx-green-11: #4cc38a; */ } - -html body { +html[data-theme=dark] body { background-color: black; } - -.dark #app-container, -.dark .left-sidebar-inner { - background-color: black !important; -} - -#right-sidebar .cp__right-sidebar-topbar { - background-color: black !important; -} - -#right-sidebar-container { +html[data-theme=dark] #app-container, +html[data-theme=dark] .left-sidebar-inner, +html[data-theme=dark] #right-sidebar .cp__right-sidebar-topbar, +html[data-theme=dark] #right-sidebar-container, +html[data-theme=dark] .sidebar-item-list, +html[data-theme=dark] .sidebar-item, +html[data-theme=dark] #logseq-tabs_lsp_main { background-color: black !important; } -.dark .sidebar-item-list, -.dark .sidebar-item { - background-color: black !important; -} - -#logseq-tabs_lsp_main { - background-color: black !important; -} +/*# sourceMappingURL=custom.css.map */ diff --git a/logseq/custom.css.map b/logseq/custom.css.map new file mode 100644 index 0000000..a853091 --- /dev/null +++ b/logseq/custom.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["custom.scss"],"names":[],"mappings":"AAAA;EACE;AAEA;AACA;AACA;;AAEA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAOE","file":"custom.css"} \ No newline at end of file diff --git a/logseq/custom.scss b/logseq/custom.scss new file mode 100644 index 0000000..1e600a8 --- /dev/null +++ b/logseq/custom.scss @@ -0,0 +1,21 @@ +html[data-theme="dark"] { + --ls-main-content-background: black; + + /* --rx-green-09: #30a46c; */ + /* --rx-green-10: #3cb179; */ + /* --rx-green-11: #4cc38a; */ + + body { + background-color: black; + } + + #app-container, + .left-sidebar-inner, + #right-sidebar .cp__right-sidebar-topbar, + #right-sidebar-container, + .sidebar-item-list, + .sidebar-item, + #logseq-tabs_lsp_main { + background-color: black !important; + } +} From 7a5bc3b08a737f15c8c7242a5d6d7197996f4bb5 Mon Sep 17 00:00:00 2001 From: Cheslav Zhuravsky Date: Wed, 11 Sep 2024 12:50:22 +0700 Subject: [PATCH 2/5] force change theme to black --- logseq/custom.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/logseq/custom.js b/logseq/custom.js index f5d2cdb..6509a30 100644 --- a/logseq/custom.js +++ b/logseq/custom.js @@ -1 +1,10 @@ +// change theme to black +if (document.querySelector("html").getAttribute("data-theme") === "light") { + document.querySelector("html").setAttribute("data-theme", "dark"); + + document.querySelector("body").classList.remove("light-theme"); + document.querySelector("body").classList.remove("white-theme"); + document.querySelector("body").classList.add("dark-theme"); +} + document.querySelector(".journals-nav .flex-1").innerHTML = "Blog"; From cfed816bd47b2ff3f2c2f234f793d26f196b3661 Mon Sep 17 00:00:00 2001 From: Cheslav Zhuravsky Date: Wed, 11 Sep 2024 12:55:03 +0700 Subject: [PATCH 3/5] add saving theme to local storage --- logseq/custom.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/logseq/custom.js b/logseq/custom.js index 6509a30..d1cf965 100644 --- a/logseq/custom.js +++ b/logseq/custom.js @@ -5,6 +5,8 @@ if (document.querySelector("html").getAttribute("data-theme") === "light") { document.querySelector("body").classList.remove("light-theme"); document.querySelector("body").classList.remove("white-theme"); document.querySelector("body").classList.add("dark-theme"); + + localStorage.setItem("theme", "dark"); } document.querySelector(".journals-nav .flex-1").innerHTML = "Blog"; From ec3fec7536a23966b3418751734bb9de6ae67d30 Mon Sep 17 00:00:00 2001 From: Cheslav Zhuravsky Date: Wed, 11 Sep 2024 13:01:55 +0700 Subject: [PATCH 4/5] fix --- logseq/custom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logseq/custom.js b/logseq/custom.js index d1cf965..113430b 100644 --- a/logseq/custom.js +++ b/logseq/custom.js @@ -6,7 +6,7 @@ if (document.querySelector("html").getAttribute("data-theme") === "light") { document.querySelector("body").classList.remove("white-theme"); document.querySelector("body").classList.add("dark-theme"); - localStorage.setItem("theme", "dark"); + localStorage.setItem("theme", '"dark"'); } document.querySelector(".journals-nav .flex-1").innerHTML = "Blog"; From aed63bee0a1c9603c56e7e78c9939407bf1b09ee Mon Sep 17 00:00:00 2001 From: Cheslav Zhuravsky Date: Wed, 11 Sep 2024 15:19:32 +0700 Subject: [PATCH 5/5] fix hashchange event --- logseq/custom.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/logseq/custom.js b/logseq/custom.js index 113430b..47067d1 100644 --- a/logseq/custom.js +++ b/logseq/custom.js @@ -10,3 +10,12 @@ if (document.querySelector("html").getAttribute("data-theme") === "light") { } document.querySelector(".journals-nav .flex-1").innerHTML = "Blog"; + +// Override the pushState method for correct hashchange event (for analytics) +// seems router issue +const originalPushState = history.pushState; + +history.pushState = function (state, title, url) { + originalPushState.apply(history, arguments); + window.dispatchEvent(new Event("hashchange")); +};