Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

深浅色切换优化 / 修复加载闪屏的bug #392

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

justaLoli
Copy link

  1. 深浅色切换逻辑优化
    原逻辑只能在页面打开时感知到系统的主题变换并自动切换。若上午打开,晚上再打开,主题无法自动切换。
    修改后的逻辑参考了fluid主题的实现方式。当网页的主题和系统主题一致时,采用自动切换。

  2. 修复加载闪屏的bug
    原逻辑在网页主题和系统主题不一致时,加载过程会伴随一次屏幕闪烁。本修改修复了这个问题。

@justaLoli justaLoli force-pushed the feature/better-toggle-theme branch from a33325f to c930c4b Compare February 27, 2025 10:19
@XPoet
Copy link
Owner

XPoet commented Feb 28, 2025

感谢贡献,请将这个 PR 提交 dev 分支。

@justaLoli justaLoli changed the base branch from master to dev February 28, 2025 01:59
@justaLoli
Copy link
Author

应该改过来了w

@justaLoli
Copy link
Author

我意识到的第二个commit并没能根除这个问题。以前是用户主题和系统主题不一致时会闪烁,现在是显示深色时闪烁。
似乎只有将主题设置的代码放在head中才能解决这个问题。我没有将整个toggle-theme.js移动而是在head里新写了一小段代码,似乎解决了这个问题。我将在我的分支下提交一个新的commit。
注意:这段代码恐怕缺乏可维护性(使用了'KEEP-THEME-STATUS'字面量)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants