Giter VIP home page Giter VIP logo

Comments (4)

sivan avatar sivan commented on August 18, 2024 1

@dyxang 明白你的意思了,请问一下你是不是改过代码去掉了[data-darkmode="auto"]相关的部分?看截图里这样,会优先使用操作系统的深色模式设置了。如果你想以左上角按钮为准,可以把@media (prefers-color-scheme: dark) {...}那一层换成body.dark

from heti.

dyxang avatar dyxang commented on August 18, 2024

@dyxang 明白你的意思了,请问一下你是不是改过代码去掉了[data-darkmode="auto"]相关的部分?看截图里这样,会优先使用操作系统的深色模式设置了。如果你想以左上角按钮为准,可以把@media (prefers-color-scheme: dark) {...}那一层换成body.dark

请问是指这个网站的代码还是Heti的代码?我没改Heti的代码。我一时间没找到data-darkmode="auto"这种代码在哪里出现,谷歌也没搜到。
换成@media (prefers-color-scheme: body.dark)后明亮模式显示正常了,但是夜间模式没有效果了

from heti.

sivan avatar sivan commented on August 18, 2024

@dyxang 抱歉,我以为明暗设置你用了项目演示网站的代码。你可以在你博客的css里(只要在heti.min.css后面引用就行)加上这一段覆盖一下。

@media (prefers-color-scheme: dark) {
    .heti blockquote {
        background-color: hsla(0, 0%, 0%, 0.054);
    }
    body.dark .heti blockquote {
        background-color: hsla(0, 0%, 100%, 0.054);
    }
}

这样可以恢复覆盖回以博客明暗调节按钮的设置展示blockquote样式。


不过类似的地方还有hr、pre等元素,因此麻烦一点的办法是一次性全改过来,以你博客的设置,可以按下面的流程:

  1. clone一份项目到本地;
  2. lib/_variables.scss中将$darkmode那行修改为$darkmode: 'manual';
  3. 下方,将$manualmode-dark-selector那行修改为$manualmode-dark-selector: 'body.dark &';
  4. 重新编译这个适合你自己的heti.min.css文件。

这样最终的文件就不会再包含@media (prefers-color-scheme: dark)相关的代码了,一切都以你博客明暗调节按钮的设置为准。

from heti.

dyxang avatar dyxang commented on August 18, 2024

有空研究一下,谢谢,有问题再Open

from heti.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.