summaryrefslogtreecommitdiff
path: root/layout/_partial/scripts.ejs
diff options
context:
space:
mode:
feat: add #btn-toggle-dark botton to toggle dark mode
- Switch dark theme to bulmaswatch/darkly, since bulma-prefers-dark highly relies on `@media: (prefers-color-scheme: dark)` tag - Add a playerman handler to toggle shikwasa theme[1] - Use localstorage to store user's preference[2] - Fix a typo: SystemDarkmodePrefrence => SystemDarkmodePreference [1]: Modified from https://github.com/jessuni/shikwasa/blob/main/pages/public/index.js#L208 [2]: Took inspiration from https://blog.skk.moe/post/hello-darkmode-my-old-friend
Diffstat (limited to 'layout/_partial/scripts.ejs')
1 files changed, 2 insertions, 1 deletions
diff --git a/layout/_partial/scripts.ejs b/layout/_partial/scripts.ejs
index 2efb659..98d39e0 100644
--- a/layout/_partial/scripts.ejs
+++ b/layout/_partial/scripts.ejs
@@ -24,13 +24,14 @@
<script>
window.addEventListener("load", () => {
const theme_selector = (mode) => {
- if (mode === SystemDarkmodePrefrence.dark) {
+ if (mode === SystemDarkmodePreference.dark) {
document.getElementById("highlight-light-theme").setAttribute("disabled", "disabled");
document.getElementById("highlight-dark-theme").removeAttribute("disabled");
} else {
document.getElementById("highlight-dark-theme").setAttribute("disabled", "disabled");
document.getElementById("highlight-light-theme").removeAttribute("disabled");
}
+ console.debug(`highlightjs theme set to ${mode}`);
};
darklistener.add(theme_selector);
}, false);