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

A brief flash of light theme when changing pages in dark mode #333

Closed
vinhphm opened this issue Mar 20, 2022 · 4 comments
Closed

A brief flash of light theme when changing pages in dark mode #333

vinhphm opened this issue Mar 20, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@vinhphm
Copy link

vinhphm commented Mar 20, 2022

Hi, firstly, thank you so much for your work on this incredible theme. Here is something I know notice during using the theme.

Describe the bug
When the page is in dark mode, changing to another page of the website could cause a brief flash of light theme before it set back to dark. It's like the flash light of a camera.

To Reproduce
Steps to reproduce the behavior:

  1. Without the theme settings in config.toml, go to the website.
  2. Set the theme to dark if it's not in dark mode already.
  3. Click to access other pages like "Posts", "Portfolio", "About",...
  4. See error

Expected behavior
The transition should be smooth and not flash a light theme appearance.

Screenshots
Screen Shot 2022-03-20 at 6 52 03 PM

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome, Safari
  • Version of the Theme: v1.8.0
  • Version of Hugo (run a hugo version if unsure): v0.94.2

Additional context

@vinhphm vinhphm added the bug Something isn't working label Mar 20, 2022
@lxndrblz
Copy link
Owner

@vinhphm Thanks for your report. Would you mind recording a short video that displays the issues?

@vinhphm
Copy link
Author

vinhphm commented Mar 21, 2022

@lxndrblz Sure. I don’t have a computer right now but here is how it happens on mobile:

FullSizeRender.MOV

@lxndrblz
Copy link
Owner

@vinhphm Thanks for the video. I will need to investigate if there is a way this brief flicker good be resolved.

@Sohn123
Copy link
Contributor

Sohn123 commented Oct 12, 2022

I had the same issue and I resolved it with the following post. Instead of applying the theme class to the body of the document, apply it to the HTML tag directly. This way the theme can be set before the initial render and there is no white flash. If I have time, I'll refactor my code and open a PR the next days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants