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」点击夜间模式后再点击其他文章依然是日间模式 #325

Closed
2 tasks done
m1luf0 opened this issue Dec 17, 2021 · 8 comments
Closed
2 tasks done

Comments

@m1luf0
Copy link

m1luf0 commented Dec 17, 2021

「描述遇到的问题」或「发现的 bug」(Describe the problem or bug you encounter)
在页面A点击夜间模式按钮,此时页面A变为夜间模式。
如果选择看其他的博客文章,那么可以通过目录点击到页面B,此时页面B还是日间模式。
如果一个用户需要在夜间模式下纵览 N 篇文章,那么他就需要点击 N 次夜间模式按钮。

你是否已经阅读过以下内容,并确认你的行为是正确的,在 [ ] 中填入 x 选中(Ensure that you had consulted followings and confirm the validity of your operation, fill x in [ ] to select)

如何复现(To Reproduce)
打开博客页面 -> 点击 夜间模式 按钮 -> 点击其他文章

信息 (please complete the following information):

  • 操作系统(OS): Ubuntu 20.04 LTS
  • 浏览器(Browser) Chrome
  • 浏览器版本(Version)[e.g. 22][可选]

其他信息(Additional context)

不知道记录用户选择黑暗模式的要求是否能够通过纯 nodejs 实现,大概需要记录一下这个夜间模式的 state 吧。

@LolipopJ
Copy link
Collaborator

LolipopJ commented Dec 17, 2021

OHH,看上去预览版本在这里出现了一点问题,每次刷新都自动获取了当前系统偏好的颜色,我看看如何修复一下,感谢反馈!


在 LocalStorage 里保存的 preferredThemeMode 属性记录了当前的颜色偏好,会否是因为您使用了无痕模式等无法保存 LocalStorage 信息呢?

LolipopJ added a commit that referenced this issue Dec 17, 2021
#325

修复了一个问题,这个问题导致主题无法记住当前偏好的颜色模式
@LolipopJ
Copy link
Collaborator

已修复!

该问题源于少传递了一个变量 🤯。

敬请继续使用!

@m1luf0
Copy link
Author

m1luf0 commented Dec 18, 2021

已修复!

该问题源于少传递了一个变量 exploding_head。

敬请继续使用!

感谢您的及时反馈!
但是我拉了一下更新后的 20211217 的代码,似乎没有变化(小声)
不知道您用什么浏览器和环境测试的呢?
我已经重新清除了浏览器缓存:
系统默认浅色 -> 打开博客 -> 点击切换到夜间模式 -> 点击其他文章 -> 浅色

Chrome Version 95.0.4638.69 (Official Build) (64-bit)
Linux 5.11.0-41-generic #45~20.04.1-Ubuntu

微信自带浏览器

华为浏览器

Chrome (Android 10 95.0.4638.74)

但是如果用iPad OS、 iOS 15下的 safari,在系统默认深色模式中,可以记录喜好为浅色的情况。

@LolipopJ
Copy link
Collaborator

抱歉,只测试了深色模式下没有问题……

接着修复这个问题!

LolipopJ added a commit that referenced this issue Dec 18, 2021
#325

1. 修复了一个问题,这个问题导致系统在偏好为浅色模式下,无法正常根据用户偏好切换主题颜色模式
2. 现在,浅色模式下也将拥有自深到浅的渐变,增加沉浸感
@LolipopJ
Copy link
Collaborator

已修复!!

敬请继续使用!如果没有您的反馈,该问题将持续存在并影响更多用户!🥰


该问题源于错误地将

<link rel="stylesheet" href="<%- url_for("css/dark.css") %>" media="(prefers-color-scheme: dark)">

认为当系统偏好为浅色模式时,就不存在该标签,导致后续 JS 代码中的判断错误。

@m1luf0
Copy link
Author

m1luf0 commented Dec 18, 2021

已修复!!

敬请继续使用!如果没有您的反馈,该问题将持续存在并影响更多用户!smiling_face_with_three_hearts

该问题源于错误地将

<link rel="stylesheet" href="<%- url_for("css/dark.css") %>" media="(prefers-color-scheme: dark)">

认为当系统偏好为浅色模式时,就不存在该标签,导致后续 JS 代码中的判断错误。

非常感谢您的跟进,已符合预期效果了。

@m1luf0 m1luf0 closed this as completed Dec 18, 2021
@m1luf0 m1luf0 reopened this Dec 18, 2021
@m1luf0
Copy link
Author

m1luf0 commented Dec 18, 2021

刚刚试的时候确实能记住用户手动选择的偏好了,但是您似乎把 自动检测系统颜色偏好的 feature 给去掉了,即无论该用户系统是否是浅色,打开首先是 dark mode。(如果是故意的当我没有说)

@m1luf0 m1luf0 closed this as completed Dec 18, 2021
@LolipopJ
Copy link
Collaborator

刚刚试的时候确实能记住用户手动选择的偏好了,但是您似乎把 自动检测系统颜色偏好的 feature 给去掉了,即无论该用户系统是否是浅色,打开首先是 dark mode。(如果是故意的当我没有说)

我发现如果是浅色模式,从暗色到浅色的沉浸感效果很棒,所以这么做了。😆

Stark-X pushed a commit to Stark-X/hexo-theme-archer that referenced this issue Apr 1, 2024
fi3ework#325

修复了一个问题,这个问题导致主题无法记住当前偏好的颜色模式
Stark-X pushed a commit to Stark-X/hexo-theme-archer that referenced this issue Apr 1, 2024
fi3ework#325

1. 修复了一个问题,这个问题导致系统在偏好为浅色模式下,无法正常根据用户偏好切换主题颜色模式
2. 现在,浅色模式下也将拥有自深到浅的渐变,增加沉浸感
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

No branches or pull requests

2 participants