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

Dark theme shows white background for an instant #83

Open
tuket opened this issue May 18, 2020 · 3 comments
Open

Dark theme shows white background for an instant #83

tuket opened this issue May 18, 2020 · 3 comments

Comments

@tuket
Copy link

tuket commented May 18, 2020

When transitioning from one page to another I can see white background for an instant.
It's a bit hard on the eyes to see this abrupt white flash.
It looks like the flash is more apparent in Firefox. In Chrome is not noticeable most of the times but happens as well sometimes.
I'm not sure if this is an easy thing to fix or it's a browser issue.

@1ace
Copy link
Contributor

1ace commented Apr 14, 2023

It's because the dark mode is implemented in javascript instead of css, which means the browser renders the page with a white background (and everything that goes with it) first, and then runs the javascript which redraws everything with a black background.

The solution is to rewrite this in CSS, using @media (prefers-color-scheme:dark) to respect the user's choice, instead of javascript buttons.
If we want users to be able to use a different color scheme on this website than the rest of their browser, then we can implement a javascript override, but that's a detail IMO and not necessary for a first version.
I have implemented all of this (including the JS overrride) myself so feel free to ping me if you (or anyone else) wants to give this a shot :)

@1ace
Copy link
Contributor

1ace commented Apr 14, 2023

(actually, if you look at the website on my profile you'll have an example of this implemented, and it's a really tiny website so it shouldn't be too hard to read its CSS & JS code)

@BSVino
Copy link
Owner

BSVino commented Apr 17, 2023

Submit a pull request and I would be happy to approve it :)

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

3 participants