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
|
# emitMetadata: 0
|
||||||
# inputPosition: top
|
# inputPosition: top
|
||||||
# lang: en
|
# lang: en
|
||||||
|
# theme: noborder_dark
|
||||||
|
@ -8,9 +8,18 @@
|
|||||||
* This solution was created with reference to:
|
* This solution was created with reference to:
|
||||||
* https://github.com/giscus/giscus/issues/336#issuecomment-1214366281
|
* https://github.com/giscus/giscus/issues/336#issuecomment-1214366281
|
||||||
*/
|
*/
|
||||||
function getGiscusTheme() {
|
function getHugoTheme() {
|
||||||
return localStorage.getItem("color-theme");
|
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 setGiscusTheme() {
|
||||||
function sendMessage(message) {
|
function sendMessage(message) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user