forked from drowl87/hextra_mirror
feat: add giscus theme customization (#522)
Co-authored-by: Xin <xin@imfing.com>
This commit is contained in:
parent
9efcda2fdd
commit
0716533699
@ -173,3 +173,4 @@ params:
|
||||
# emitMetadata: 0
|
||||
# inputPosition: top
|
||||
# lang: en
|
||||
# theme: noborder_dark
|
||||
|
@ -8,10 +8,19 @@
|
||||
* This solution was created with reference to:
|
||||
* https://github.com/giscus/giscus/issues/336#issuecomment-1214366281
|
||||
*/
|
||||
function getGiscusTheme() {
|
||||
function getHugoTheme() {
|
||||
return localStorage.getItem("color-theme");
|
||||
}
|
||||
|
||||
function getGiscusTheme() {
|
||||
let giscusTheme = "{{ (string .theme) | default `light` }}";
|
||||
if(getHugoTheme() == 'light') {
|
||||
return giscusTheme.replace('dark', 'light');
|
||||
} else {
|
||||
return giscusTheme.replace('light', 'dark');
|
||||
}
|
||||
}
|
||||
|
||||
function setGiscusTheme() {
|
||||
function sendMessage(message) {
|
||||
const iframe = document.querySelector('iframe.giscus-frame');
|
||||
|
Loading…
x
Reference in New Issue
Block a user