remark42 theme change automatically when chripy theme changes
This commit is contained in:
parent
feda9f8675
commit
bb07412482
@ -6,7 +6,7 @@
|
||||
|
||||
max_shown_comments: 10,
|
||||
// theme: 'light',
|
||||
theme: document.documentElement.hasAttribute("data-mode")? "dark": "light",
|
||||
theme: document.documentElement.hasAttribute("data-mode") ? "dark" : "light",
|
||||
|
||||
locale: 'en',
|
||||
show_email_subscription: false
|
||||
@ -22,6 +22,18 @@
|
||||
}
|
||||
})(remark_config.components || ['embed']);
|
||||
|
||||
var targetDiv = document.getElementById("sidebar").getElementsByClassName("mode-toggle")[0];
|
||||
|
||||
if (targetDiv != null) {
|
||||
targetDiv.addEventListener("click", () => {
|
||||
if (document.documentElement.hasAttribute("data-mode")) {
|
||||
window.REMARK42.changeTheme('dark');
|
||||
} else {
|
||||
window.REMARK42.changeTheme('light');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="remark42">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user