mirror of
https://github.com/PKUFlyingPig/cs-self-learning.git
synced 2026-06-23 18:06:56 +08:00
[FEATURE]: dynamic theme change for giscus
reformat and update giscus theme color to protanopia
This commit is contained in:
parent
2d6b3bb510
commit
dfd945ac8f
1 changed files with 5 additions and 15 deletions
|
|
@ -1,20 +1,10 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block disqus %}
|
{% block disqus %}
|
||||||
<script src="https://giscus.app/client.js"
|
<script src="https://giscus.app/client.js" data-repo="PKUFlyingPig/cs-self-learning" data-repo-id="R_kgDOGP67ng"
|
||||||
data-repo="PKUFlyingPig/cs-self-learning"
|
data-category="Announcements" data-category-id="DIC_kwDOGP67ns4COM9Q" data-mapping="title"
|
||||||
data-repo-id="R_kgDOGP67ng"
|
data-reactions-enabled="1" data-emit-metadata="0" data-input-position="top" data-theme="light" data-lang="zh-CN"
|
||||||
data-category="Announcements"
|
data-loading="lazy" crossorigin="anonymous" async>
|
||||||
data-category-id="DIC_kwDOGP67ns4COM9Q"
|
|
||||||
data-mapping="title"
|
|
||||||
data-reactions-enabled="1"
|
|
||||||
data-emit-metadata="0"
|
|
||||||
data-input-position="top"
|
|
||||||
data-theme="light"
|
|
||||||
data-lang="zh-CN"
|
|
||||||
data-loading="lazy"
|
|
||||||
crossorigin="anonymous"
|
|
||||||
async>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -23,7 +13,7 @@
|
||||||
ref.addEventListener("change", function () {
|
ref.addEventListener("change", function () {
|
||||||
var palette = __get("__palette")
|
var palette = __get("__palette")
|
||||||
if (palette && typeof palette.color === "object") {
|
if (palette && typeof palette.color === "object") {
|
||||||
const theme = palette.color.scheme === "slate" ? "dark" : "light"
|
const theme = palette.color.scheme === "slate" ? "dark_protanopia" : "light_protanopia"
|
||||||
const frame = document.querySelector(".giscus-frame")
|
const frame = document.querySelector(".giscus-frame")
|
||||||
frame.contentWindow.postMessage({
|
frame.contentWindow.postMessage({
|
||||||
giscus: { setConfig: { theme } }
|
giscus: { setConfig: { theme } }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue