前言
主题作者:WordPress博客主题二次元风-lolimeow主题
该主题是一个很棒的主题,本站也使用了此主题,但是就是没有适应黑暗模式。
让作者很不舒服,所以作者主动适配了黑暗模式。
由于作者仅仅适配了自己网站上所使用的组件若您使用的组件没有适配,请发送评论区催促作者适配。
适配代码
代码已失效,下面代码仅作示例,请勿直接使用
<script type="text/javascript"> var link = document.createElement('link'); link.setAttribute('type', 'text/css'); link.setAttribute('rel', 'stylesheet'); link.setAttribute('href', 'https://source.sober-up.cn/CSS/Blog/Dark.css'); document.head.appendChild(link); isNeedFix = false; if (document.querySelector("input[id='rememberme']") != null) isNeedFix = true; if (document.querySelector("form[name='registerform']") != null) isNeedFix = true; if (document.querySelector("form[id='wp_pass_reset']") != null) isNeedFix = true; if (isNeedFix) { link = document.createElement('link'); link.setAttribute('type', 'text/css'); link.setAttribute('rel', 'stylesheet'); link.setAttribute('href', 'https://source.sober-up.cn/CSS/Blog/DarkFix.css'); document.head.appendChild(link); } </script>
效果
手机或电脑打开夜间模式或黑暗主题(叫法不统一),查看效果
文章有(6)条网友点评
大佬牛逼
文章目录怎么设置的
@ honge 文章目录是我魔改的内容
@ STHUDY 出个教程呗,挺喜欢的
@ honge 行,等几天就出,现在比较忙
底部Theme by LoLiMeow可以拿掉吗大神,看着不舒服